jobs
Creates, updates, deletes, gets or lists a jobs resource.
Overview​
| Name | jobs |
| Type | Resource |
| Id | ovh.cloud_ai.jobs |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Job Id |
created_at | string (date-time) | Job creation date (wire: createdAt) |
spec | object | Job specifications |
status | object | Job status |
updated_at | string (date-time) | Job update date (wire: updatedAt) |
user | string | Job user owner |
AI Solutions Job Object
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Job Id |
created_at | string (date-time) | Job creation date (wire: createdAt) |
spec | object | Job specifications |
status | object | Job status |
updated_at | string (date-time) | Job update date (wire: updatedAt) |
user | string | Job user owner |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | job_id, service_name | Get job information | |
list | select | service_name | label_selector, order, page, size, sort, status_state, updated_after, updated_before, user_name | List jobs |
create | insert | service_name, image, region, resources | Create a new job | |
delete | delete | job_id, service_name | force | Permanently delete a job |
command | exec | service_name, image, region, resources | Generate a job spec corresponding CLI command | |
datasync | exec | jobId, service_name | Starts a manual data synchronization on an AI Solutions job | |
kill | exec | jobId, service_name | Kill a AI Solutions job | |
update_label | exec | jobId, service_name, name | Update/add an AI Solutions job label |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
jobId | string (uuid) | Job ID |
job_id | string (uuid) | Job ID (wire: jobId) |
service_name | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
force | boolean | Force job deletion by killing it if at a running state |
label_selector | string | Filter on job label (e.g. 'job_name=potions_cooking') (wire: labelSelector) |
order | string | Order the result set |
page | integer | Page of the result set |
size | integer | Size of the result set |
sort | string | Sort the result with this field |
status_state | array | Filter on status state (wire: statusState) |
updated_after | string (date-time) | Filter on updatedAt property (>) (wire: updatedAfter) |
updated_before | string (date-time) | Filter on updatedAt property (<) (wire: updatedBefore) |
user_name | string | User that submit the job (wire: userName) |
SELECT examples​
- get
- list
Get job information
SELECT
id,
created_at,
spec,
status,
updated_at,
user
FROM ovh.cloud_ai.jobs
WHERE job_id = '{{ job_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
List jobs
SELECT
id,
created_at,
spec,
status,
updated_at,
user
FROM ovh.cloud_ai.jobs
WHERE service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND label_selector = '{{ label_selector }}'
AND order = '{{ order }}'
AND page = '{{ page }}'
AND size = '{{ size }}'
AND sort = '{{ sort }}'
AND status_state = '{{ status_state }}'
AND updated_after = '{{ updated_after }}'
AND updated_before = '{{ updated_before }}'
AND user_name = '{{ user_name }}'
;
INSERT examples​
- create
- Manifest
Create a new job
INSERT INTO ovh.cloud_ai.jobs (
command,
default_http_port,
env_vars,
grpc_port,
image,
labels,
name,
partner_id,
read_user,
region,
resources,
ssh_public_keys,
timeout,
timeout_auto_restart,
unsecure_http,
volumes,
service_name
)
SELECT
'{{ command }}',
{{ default_http_port }},
'{{ env_vars }}',
{{ grpc_port }},
'{{ image }}' /* required */,
'{{ labels }}',
'{{ name }}',
'{{ partner_id }}',
'{{ read_user }}',
'{{ region }}' /* required */,
'{{ resources }}' /* required */,
'{{ ssh_public_keys }}',
{{ timeout }},
{{ timeout_auto_restart }},
{{ unsecure_http }},
'{{ volumes }}',
'{{ service_name }}'
RETURNING
id,
created_at,
spec,
status,
updated_at,
user
;
# Description fields are for documentation purposes
- name: jobs
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the jobs resource.
- name: command
value:
- "{{ command }}"
description: |
Job command
- name: default_http_port
value: {{ default_http_port }}
description: |
Port use as the default one to access http service inside job
- name: env_vars
description: |
List of environment variable to be set inside job
value:
- name: "{{ name }}"
value: "{{ value }}"
- name: grpc_port
value: {{ grpc_port }}
description: |
GRPC Port that we want to expose in case workload HTTP & gRPC servers cannot be multiplexed to listen on the same port
- name: image
value: "{{ image }}"
description: |
Job image
- name: labels
value: "{{ labels }}"
description: |
Labels are used to scope tokens, labels prefixed by 'ovh/' are owned by the platform and overridden
- name: name
value: "{{ name }}"
description: |
Job name
- name: partner_id
value: "{{ partner_id }}"
description: |
Partner ID
- name: read_user
value: "{{ read_user }}"
description: |
User ID to use to access the job
- name: region
value: "{{ region }}"
description: |
Host region of the job
- name: resources
description: |
Job resources
value:
cpu: {{ cpu }}
ephemeralStorage: {{ ephemeralStorage }}
flavor: "{{ flavor }}"
flavorCount: {{ flavorCount }}
gpu: {{ gpu }}
gpuBrand: "{{ gpuBrand }}"
gpuMemory: {{ gpuMemory }}
gpuModel: "{{ gpuModel }}"
memory: {{ memory }}
privateNetwork: {{ privateNetwork }}
publicNetwork: {{ publicNetwork }}
- name: ssh_public_keys
value:
- "{{ ssh_public_keys }}"
description: |
SSH keys authorized to access to the job container
- name: timeout
value: {{ timeout }}
description: |
Maximum time to spend before killing the job
- name: timeout_auto_restart
value: {{ timeout_auto_restart }}
description: |
Whether job is set to be restarted after timeout
- name: unsecure_http
value: {{ unsecure_http }}
description: |
Whether job api port can be accessed without any authentication token
- name: volumes
description: |
Job Data linked
value:
- cache: {{ cache }}
container: "{{ container }}"
dataStore:
alias: "{{ alias }}"
archive: "{{ archive }}"
container: "{{ container }}"
internal: {{ internal }}
prefix: "{{ prefix }}"
id: "{{ id }}"
mountPath: "{{ mountPath }}"
permission: "{{ permission }}"
prefix: "{{ prefix }}"
publicGit:
url: "{{ url }}"
publicSwift:
url: "{{ url }}"
region: "{{ region }}"
standalone:
name: "{{ name }}"
targetDataStore:
alias: "{{ alias }}"
archive: "{{ archive }}"
container: "{{ container }}"
internal: {{ internal }}
prefix: "{{ prefix }}"
volumeSource:
dataStore:
alias: "{{ alias }}"
archive: "{{ archive }}"
container: "{{ container }}"
internal: {{ internal }}
prefix: "{{ prefix }}"
publicGit:
url: "{{ url }}"
publicSwift:
url: "{{ url }}"
standalone:
name: "{{ name }}"
volumeTarget:
targetDataStore:
alias: "{{ alias }}"
archive: "{{ archive }}"
container: "{{ container }}"
internal: {{ internal }}
prefix: "{{ prefix }}"
DELETE examples​
- delete
Permanently delete a job
DELETE FROM ovh.cloud_ai.jobs
WHERE job_id = '{{ job_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
AND force = '{{ force }}'
;
Lifecycle Methods​
EXEC variables use wire (API) names.
- command
- datasync
- kill
- update_label
Generate a job spec corresponding CLI command
EXEC ovh.cloud_ai.jobs.command
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"command": "{{ command }}",
"defaultHttpPort": {{ defaultHttpPort }},
"envVars": "{{ envVars }}",
"grpcPort": {{ grpcPort }},
"image": "{{ image }}",
"labels": "{{ labels }}",
"name": "{{ name }}",
"partnerId": "{{ partnerId }}",
"readUser": "{{ readUser }}",
"region": "{{ region }}",
"resources": "{{ resources }}",
"sshPublicKeys": "{{ sshPublicKeys }}",
"timeout": {{ timeout }},
"timeoutAutoRestart": {{ timeoutAutoRestart }},
"unsecureHttp": {{ unsecureHttp }},
"volumes": "{{ volumes }}"
}'
;
Starts a manual data synchronization on an AI Solutions job
EXEC ovh.cloud_ai.jobs.datasync
@jobId='{{ jobId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"direction": "{{ direction }}",
"volume": "{{ volume }}"
}'
;
Kill a AI Solutions job
EXEC ovh.cloud_ai.jobs.kill
@jobId='{{ jobId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Update/add an AI Solutions job label
EXEC ovh.cloud_ai.jobs.update_label
@jobId='{{ jobId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"name": "{{ name }}",
"value": "{{ value }}"
}'
;