Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-404: Add --skip-upload-to-source option in JupyterNotebookCommand #315

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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