Skip to content

Commit 656a178

Browse files
committed
WIP: fix AttributeError when --ignoreFiles was used
(cherry picked from commit e900e5b)
1 parent a3d6595 commit 656a178

File tree

10 files changed

+6
-23
lines changed

10 files changed

+6
-23
lines changed

gradient/api_sdk/clients/job_client.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def create(
4141
workspace_archive=None,
4242
workspace_url=None,
4343
working_directory=None,
44-
ignore_files=None,
4544
experiment_id=None,
4645
job_env=None,
4746
use_dockerfile=None,
@@ -115,8 +114,6 @@ def create(
115114
:param str workspace_url: url to repo with code to run inside of job.
116115
(Currently being deprecated in an upcoming version.)
117116
:param str working_directory: location of code to run. By default ``/paperspace``
118-
:param str ignore_files: This field is used with CLI to upload workspace from your computer without specified
119-
files. Provide string with comma `,` separated name of files that should be ignored with upload of workspace.
120117
:param str experiment_id: Id of experiment to which job should be connected. If not provided there will be
121118
created new experiment for this job.
122119
:param dict job_env: key value collection of envs that are used in code
@@ -150,7 +147,6 @@ def create(
150147
workspace_archive=workspace_archive,
151148
workspace_url=workspace_url,
152149
working_directory=working_directory,
153-
ignore_files=ignore_files,
154150
experiment_id=experiment_id,
155151
job_env=job_env,
156152
use_dockerfile=use_dockerfile,

gradient/api_sdk/models/job.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ class Job(object):
7777
workspace = attr.ib(type=str, default=None)
7878
workspace_archive = attr.ib(type=str, default=None)
7979
workspace_file_name = attr.ib(type=str, default=None)
80-
ignore_files = attr.ib(type=str, default=None)
8180
use_dockerfile = attr.ib(type=str, default=None)
8281
rel_dockerfile_path = attr.ib(type=str, default=None)
8382
registry_username = attr.ib(type=str, default=None)

gradient/api_sdk/serializers/job.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ class JobSchema(BaseSchema):
8181
command = marshmallow.fields.Str()
8282
workspace = marshmallow.fields.Str()
8383
workspace_archive = marshmallow.fields.Str(dump_to="workspaceArchive", load_from="workspaceArchive")
84-
ignore_files = marshmallow.fields.Str(dump_to="ignoreFiles", load_from="ignoreFiles")
8584
use_dockerfile = marshmallow.fields.Bool(dump_to="useDockerfile", load_from="useDockerfile")
8685
rel_dockerfile_path = marshmallow.fields.Str(dump_to="relDockerfilePath", load_from="relDockerfilePath")
8786
registry_username = marshmallow.fields.Str(dump_to="registryUsername", load_from="registryUsername")

gradient/api_sdk/workspace.py

Whitespace-only changes.

gradient/commands/experiments.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ def __init__(self, workspace_handler, *args, **kwargs):
2828
self.workspace_handler = workspace_handler
2929

3030
def execute(self, json_, use_vpc=False):
31-
if "ignore_files" in json_:
32-
json_["ignore_files"] = self._parse_comma_separated_to_list(json_["ignore_files"])
33-
3431
self._handle_workspace(json_)
3532

3633
with halo.Halo(text=self.SPINNER_MESSAGE, spinner="dots"):
@@ -56,14 +53,6 @@ def _handle_workspace(self, instance_dict):
5653
def _create(self, json_, use_vpc):
5754
pass
5855

59-
@staticmethod
60-
def _parse_comma_separated_to_list(s):
61-
if not s:
62-
return []
63-
64-
list_of_str = [s.strip() for s in s.split(",")]
65-
return list_of_str
66-
6756

6857
class CreateSingleNodeExperimentCommand(BaseCreateExperimentCommandMixin, BaseExperimentCommand):
6958
def _create(self, json_, use_vpc=False):

gradient/commands/jobs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ def _make_table(self, logs, job_id):
194194
class CreateJobCommand(BaseCreateJobCommandMixin, BaseJobCommand):
195195

196196
def _create(self, json_, data):
197+
# because ignore_files is used by workspace handlers and not needed anymore (will fail if not "popped")
198+
json_.pop("ignore_files", None)
197199
return self.client.create(data=data, **json_)
198200

199201

@@ -216,7 +218,6 @@ def create(
216218
workspace_archive=None,
217219
workspace_url=None,
218220
working_directory=None,
219-
ignore_files=None,
220221
experiment_id=None,
221222
job_env=None,
222223
use_dockerfile=None,
@@ -243,7 +244,6 @@ def create(
243244
workspace_archive=workspace_archive,
244245
workspace_url=workspace_url,
245246
working_directory=working_directory,
246-
ignore_files=ignore_files,
247247
experiment_id=experiment_id,
248248
job_env=job_env,
249249
use_dockerfile=use_dockerfile,
@@ -268,7 +268,7 @@ def _get_client(self, api_key, logger_):
268268
return self.client
269269

270270
http_client_ = http_client.API(config.config.CONFIG_HOST, api_key=api_key, logger=logger_)
271-
client = JobRunClient(http_client_, logger_, http_client_)
271+
client = JobRunClient(http_client_, api_key=api_key, logger=logger_)
272272
return client
273273

274274

gradient/workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from requests_toolbelt.multipart import encoder
88

99
from gradient import utils
10-
from gradient.logger import Logger
1110
from gradient.exceptions import S3UploadFailedError, ProjectAccessDeniedError, PresignedUrlAccessDeniedError, \
1211
PresignedUrlUnreachableError, PresignedUrlConnectionError, PresignedUrlMalformedResponseError, PresignedUrlError
12+
from gradient.logger import Logger
1313

1414

1515
class MultipartEncoder(object):

tests/functional/test_experiments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ class TestExperimentsCreateAndStartSingleNode(TestExperimentsCreateSingleNode):
433433
"--machineType", "testType",
434434
"--command", "testCommand",
435435
"--workspaceUrl", "some-workspace",
436+
"--no-logs",
436437
"--vpc",
437438
]
438439
EXPECTED_STDOUT = "New experiment created and started with ID: sadkfhlskdjh\n"
@@ -512,6 +513,7 @@ class TestExperimentsCreateAndStartMultiNode(TestExperimentsCreateMultiNode):
512513
"--parameterServerCount", 2,
513514
"--workerContainerUser", "usr",
514515
"--workspace", "https://github.com/Paperspace/gradient-cli.git",
516+
"--no-logs",
515517
"--vpc",
516518
]
517519
EXPECTED_STDOUT = "New experiment created and started with ID: sadkfhlskdjh\n"

tests/functional/test_jobs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ class TestJobsCreate(object):
492492
"cluster": "some_cluster_name",
493493
"startedByUserId": "some_user_id",
494494
"isPreemptible": True,
495-
"ignoreFiles": "file1,file2",
496495
"container": "some_container",
497496
"workingDirectory": "/some/path",
498497
"projectId": "some_project_id",

tests/functional/test_run.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,5 @@ def test_should_read_options_from_yaml_file(self, workspace_zip_patched, post_pa
144144
'jobEnv': {'key': 'val'},
145145
'registryUsername': 'some_registry_username',
146146
'startedByUserId': 'some_user_id',
147-
'ignoreFiles': 'file1,file2',
148147
'ports': '8080,9000:9900',
149148
'workspaceUrl': 'some.url'})

0 commit comments

Comments
 (0)