This repository was archived by the owner on Aug 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,11 @@ def list_jobs(api_key, **filters):
6060 jobs_api = client .API (config .CONFIG_HOST , api_key = api_key )
6161 command = jobs_commands .ListJobsCommand (api = jobs_api )
6262 command .execute (filters )
63+
64+
65+ @jobs_group .command ("create" , help = "Create job" )
66+ @common .api_key_option
67+ def create_job (api_key , ** kwargs ):
68+ jobs_api = client .API (config .CONFIG_HOST , api_key = api_key )
69+ command = jobs_commands .CreateJobCommand (api = jobs_api )
70+ command .execute (kwargs )
Original file line number Diff line number Diff line change 44
55from paperspace .commands import CommandBase
66from paperspace .utils import get_terminal_lines
7+ from paperspace .workspace import S3WorkspaceHandler
78
89
910class JobsCommandBase (CommandBase ):
@@ -82,3 +83,16 @@ def _make_table(jobs):
8283 ascii_table = terminaltables .AsciiTable (data )
8384 table_string = ascii_table .table
8485 return table_string
86+
87+
88+ class CreateJobCommand (JobsCommandBase ):
89+ def __init__ (self , workspace_handler = None , ** kwargs ):
90+ super (CreateJobCommand , self ).__init__ (** kwargs )
91+ self .workspace_handler = workspace_handler or S3WorkspaceHandler (api = self .api , logger = self .logger )
92+
93+ def execute (self , json_ ):
94+ url = "/jobs/createJob/"
95+ response = self .api .post (url , json_ )
96+ self ._log_message (response ,
97+ "Job created" ,
98+ "Unknown error while creating job" )
You can’t perform that action at this time.
0 commit comments