pyslurmutils.client.rest.pyconn.SlurmPyConnRestClient#
- class pyslurmutils.client.rest.pyconn.SlurmPyConnRestClient(url='', user_name='', token='', api_version='', parameters=None, log_directory=None, std_split=False, request_options=None, pre_script=None, post_script=None, python_cmd=None)[source]#
Bases:
SlurmScriptRestClient
SLURM API to submit, cancel and monitor scripts that start a python process to establish a connection over which python functions can be executed. This class does not contain any job-related state.
- Parameters:
url (
str
)user_name (
str
)token (
str
)api_version (
str
)parameters (
Optional
[dict
])log_directory (
Optional
[str
])std_split (
Optional
[bool
])request_options (
Optional
[dict
])pre_script (
Optional
[str
])post_script (
Optional
[str
])python_cmd (
Optional
[str
])
- cancel_job(job_id, request_options=None)#
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
None
- clean_job_artifacts(job_id, job_properties=None, request_options=None)#
- Parameters:
job_id (
int
)job_properties (
Optional
[BaseModel
])request_options (
Optional
[dict
])
- Return type:
None
- clean_job_artifacts_context(job_id, job_properties=None, request_options=None)#
- Parameters:
job_id (
int
)job_properties (
Optional
[BaseModel
])request_options (
Optional
[dict
])
- Return type:
Generator
[None
,None
,None
]
- delete(path, **kwargs)#
- Parameters:
path (
str
)- Return type:
Optional
[BaseModel
]
- get(path, **kwargs)#
- Parameters:
path (
str
)- Return type:
Optional
[BaseModel
]
- get_all_job_properties(raise_on_error=True, request_options=None, filter=None, update_time=None, all_users=False)#
- Parameters:
request_options (
Optional
[dict
])filter (
Optional
[dict
])update_time (
Optional
[datetime
])all_users (
bool
)
- Return type:
List
[BaseModel
]
- get_full_status(job_id, request_options=None)#
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
dict
- get_job_properties(job_id, raise_on_error=True, request_options=None)#
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
Optional
[BaseModel
]
- get_status(job_id, request_options=None)#
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
str
- is_finished(job_id)#
Returns True when the job is completely finished.
- Parameters:
job_id (
int
)- Return type:
bool
- is_finishing(job_id, request_options=None)#
Returns True when the job is finished by Slurm is still finalizing.
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
bool
- log_stdout_stderr(job_id, logger=None, level=20, request_options=None, **log_options)#
- Parameters:
job_id (
int
)logger (
Optional
[Logger
])level (
int
)request_options (
Optional
[dict
])
- Return type:
None
- post(path, **kwargs)#
- Parameters:
path (
str
)- Return type:
Optional
[BaseModel
]
- print_stdout_stderr(job_id, request_options=None)#
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
None
- redirect_stdout_stderr(job_id, request_options=None)#
Redirect logs files to the local root logger within this context.
- Parameters:
job_id (
int
)request_options (
Optional
[dict
])
- Return type:
Generator
[None
,None
,None
]
- request(method, path, request_options=None, raise_on_error=True)#
- Parameters:
method (
str
)path (
str
)request_options (
Optional
[dict
])raise_on_error (
bool
)
- Return type:
Optional
[BaseModel
]
- server_has_api(request_options=None)#
- Parameters:
request_options (
Optional
[dict
])- Return type:
Union
[bool
,str
,List
[str
]]
- submit_job(script, parameters=None, metadata=None, request_options=None)#
Returns the SLURM job ID
- Parameters:
script (
str
)parameters (
Optional
[dict
])metadata (
Union
[str
,dict
,None
])request_options (
Optional
[dict
])
- Return type:
int
- submit_script(worker_proxy, pre_script=None, post_script=None, python_cmd=None, parameters=None, metadata=None, request_options=None)[source]#
Submit a script that will establish a connection initialized in the current process.
- Parameters:
worker_proxy (
RemoteWorkerProxy
)pre_script (
Optional
[str
])post_script (
Optional
[str
])python_cmd (
Optional
[str
])parameters (
Optional
[dict
])metadata (
Union
[str
,dict
,None
])request_options (
Optional
[dict
])
- Return type:
int
- wait_finished(job_id, **kw)#
Wait until a job is finished and return the state.
- Parameters:
job_id (
int
)- Return type:
str
- wait_finishing(job_id, **kw)#
Wait until a job is finished or in the process of finishing and return the state.
- Parameters:
job_id (
int
)- Return type:
str
- wait_states(job_id, states, progress=False, timeout=None, period=0.5)#
Wait until a job state is reached and return the state.
- Parameters:
job_id (
int
)states (
Tuple
[str
])progress (
bool
)timeout (
Optional
[float
])period (
float
)
- Return type:
str