k8s_client.views.users.jobs¶
Module Contents¶
Functions¶
|
Upload a file for a reserved job |
|
Start a reserved job |
|
Kills a running job |
|
Cancel a pending job |
|
Deletes a job |
|
Get user jobs list |
|
Get user jobs count |
|
Creates a new job |
- k8s_client.views.users.jobs.upload_file_for_job(username=None, job_uuid=None)¶
Upload a file for a reserved job
Parameters¶
"username": string, optionalName of the owner user for which to upload the file
"job_uuid": stringUUID of the job to upload the file
Returns¶
[code: 404]Error message if:usernameis NOT inside the DBjob_uuidis NOT inside the DB or is not reserved
[code: 200]OKif the job is in reserved status
- k8s_client.views.users.jobs.start_job(username=None, job_uuid=None)¶
Start a reserved job
Parameters¶
"username": string, optionalName of the owner user for which to start the job
"job_uuid": stringUUID of the job to start
Returns¶
[code: 404]Error message if:usernameis NOT inside the DBjob_uuidis NOT inside the DB or is not reserved
[code: 200]OKif the job is in reserved status
- k8s_client.views.users.jobs.kill_job(username=None, job_uuid=None)¶
Kills a running job
Parameters¶
"username": string, optionalName of the owner user for which to kill the job
"job_uuid": stringUUID of the job to kill
Returns¶
[code: 404]Error message if:usernameis NOT inside the DBjob_uuidis NOT inside the DB or is not running
[code: 200]OKif the job is in running status
- k8s_client.views.users.jobs.cancel_job(username=None, job_uuid=None)¶
Cancel a pending job
Parameters¶
"username": string, optionalName of the owner user for which to cancel the job
"job_uuid": stringUUID of the job to cancel
Returns¶
[code: 404]Error message if:usernameis NOT inside the DBjob_uuidis NOT inside the DB or is not in a pending status
[code: 200]list [string]Array containing the cancelled job if the job is in pending or reserved status
[code: 200]list []empty list otherwise
- k8s_client.views.users.jobs.delete_job(username=None, job_uuid=None)¶
Deletes a job
Parameters¶
"username": string, optionalName of the owner user for which to delete the job
"job_uuid": stringUUID of the job to delete
Returns¶
[code: 404]Error message if:usernameis NOT inside the DBjob_uuidis NOT inside the DB
[code: 200]list [string]Array containing the deleted job
- k8s_client.views.users.jobs.get_jobs(username=None, limit=None, offset=0)¶
Get user jobs list
Parameters¶
"username": string, optionalName of the owner user for which to get the jobs count
"offset": int, optionalOffset of the jobs list items count. Used for pagination
"limit": int, optionalLimit of the jobs list items count. Used for pagination
Query parameters:¶
"image_id": int, optionalImage Id for which to get the jobs count
"context_id": int, optionalContext Id for which to get the jobs count
"status": string, optionalStatus for which to get the jobs count
"image_tag_id": int, optionalImage tag Id for which to get the jobs count
"node_id": int, optionalNode Id for which to get the jobs count
"node_name": string, optionalNode Name for which to get the jobs count
"paradigm": string, optionalParadigm for which to get the jobs count
"uuid": string, optionalUUID for which to get the jobs count
Returns¶
[code: 406]Error message if:usernameis NOT inside the DB
[code: 200]intCount of user jobs otherwise
- k8s_client.views.users.jobs.get_jobs_count(username=None)¶
Get user jobs count
Parameters¶
"username": string,Name of the owner user for which to get the jobs count
Returns¶
[code: 406]Error message if:usernameis NOT inside the DB
[code: 200]intCount of user jobs otherwise
- k8s_client.views.users.jobs.post_jobs(username=None)¶
Creates a new job
Parameters¶
- Request Bodyjson
- JSON containing data for the data:
"cores_to_use": intNumber of cores to use to run the application
"context_name": stringName of the context to use to run the application
"docker_image_name": stringName of the image representing the application to run
"docker_image_tag"string,Version of the image representing the application to run. Semver
"username": string,Name of the owner user to use to run the application
"paradigm": string,Paradigm to use. Values allowed: mpi | openmp
"env_variables": stringString representing the list of variables to pass to the application. The list will be of the form “name1=value1, …, nameK=valueK” All the variables will be instanced inside the environment where the application runs
"new_job_status"string, optionalString representing the status of the new job. Default is “pending”
Accepted values: pending, reserved
Returns¶
[code: 406]Error message if:context_nameis NOT inside the DBparadigmis NOT validusernameis NOT inside the DBcores_to_useis a number that overcomes the available cores for the selected contextnew_job_statusis NOT valid
[code: 200]dict [str, str]if
INPUTis valid
Examples¶
>>> Body = { "cores_to_use": 30, "context_name": "context.dev.k8s.master.dafni.hydra.org.uk", "docker_image_name": "umwrg/openmp-test-2022", "docker_image_tag" : "0.0.12", "username": "a86302gb", "paradigm": "openmp", "env_variables": "API_USER=pippo, NP=75" } Returns { "job_uuid": "187fe2b9-5003-406f-8bd5-7a7931752e7d", "log_file_name": "a86302gb.187fe2b9-5003-406f-8bd5-7a7931752e7d.log" }