Skip to content

Commit

Permalink
SDK-404: Add --skip-upload-to-source option in JupyterNotebookCommand (
Browse files Browse the repository at this point in the history
  • Loading branch information
tgvr authored and chattarajoy committed Apr 22, 2020
1 parent 041151c commit ce5745c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qds_sdk/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,9 @@ class JupyterNotebookCommand(Command):
optparser.add_option("--print-logs-live", action="store_true",
dest="print_logs_live", default=False, help="Fetch logs \
and print them to stderr while command is running.")
optparser.add_option("--skip-upload-to-source", action="store_false",
dest="upload_to_source", default=True, help="Do not \
upload notebook to source after completion of execution")

@classmethod
def parse(cls, args):
Expand Down
31 changes: 31 additions & 0 deletions tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,7 @@ def test_submit_cluster_label(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2116,6 +2117,7 @@ def test_submit_macros(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2136,6 +2138,7 @@ def test_submit_arguments(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2156,6 +2159,7 @@ def test_submit_tags(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2176,6 +2180,7 @@ def test_submit_name(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2196,6 +2201,7 @@ def test_submit_notify(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': True,
'pool': None})

Expand All @@ -2216,6 +2222,7 @@ def test_submit_timeout(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2236,9 +2243,31 @@ def test_submit_pool(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': 'batch'})

def test_submit_skip_upload_to_source(self):
sys.argv = ['qds.py', 'jupyternotebookcmd', 'submit', '--path', 'folder/file',
'--skip-upload-to-source']
print_command()
Connection._api_call = Mock(return_value={'id': 1234})
qds.main()
Connection._api_call.assert_called_with('POST', 'commands',
{'retry': None,
'name': None,
'tags': None,
'label': None,
'macros': None,
'arguments': None,
'timeout': None,
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': False,
'can_notify': False,
'pool': None})

def test_submit_retry(self):
sys.argv = ['qds.py', 'jupyternotebookcmd', 'submit', '--path', 'folder/file',
'--retry', '1']
Expand All @@ -2256,6 +2285,7 @@ def test_submit_retry(self):
'path': 'folder/file',
'retry_delay': None,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand All @@ -2276,6 +2306,7 @@ def test_submit_retry_delay(self):
'path': 'folder/file',
'retry_delay': 2,
'command_type': 'JupyterNotebookCommand',
'upload_to_source': True,
'can_notify': False,
'pool': None})

Expand Down

0 comments on commit ce5745c

Please sign in to comment.