Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 498f8e9

Browse files
committed
artifactsDestroy command added
1 parent 1dc1e57 commit 498f8e9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

paperspace/cli/jobs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,13 @@ def list_logs(job_id, api_key=None):
105105
logs_api = client.API(config.CONFIG_LOG_HOST, api_key=api_key)
106106
command = jobs_commands.JobLogsCommand(api=logs_api)
107107
command.execute(job_id)
108+
109+
110+
@jobs_group.command("artifactsDestroy", help="Destroy job's artifacts")
111+
@click.argument("job_id")
112+
@click.option("--files", "files")
113+
@common.api_key_option
114+
def destroy_artifacts(job_id, api_key=None, files=None):
115+
jobs_api = client.API(config.CONFIG_HOST, api_key=api_key)
116+
command = jobs_commands.ArtifactsDestroyCommand(api=jobs_api)
117+
command.execute(job_id, files=files)

paperspace/commands/jobs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,13 @@ def execute(self, json_):
158158
self._log_message(response,
159159
"Job created",
160160
"Unknown error while creating job")
161+
162+
163+
class ArtifactsDestroyCommand(JobsCommandBase):
164+
def execute(self, job_id, files=None):
165+
url = '/jobs/{}/artifactsDestroy'.format(job_id)
166+
params = None
167+
if files:
168+
params = {'files': files}
169+
response = self.api.post(url, params=params)
170+
self._log_message(response, "Artifacts destroyed", "Unknown error while destroying artifacts")

0 commit comments

Comments
 (0)