Class QJob
This class manages Jobs life cycle: logical group of tasks.
Inherited Members
Namespace: QarnotSDK
Assembly: QarnotSDK.dll
Syntax
public class QJob
Constructors
QJob(Connection, Guid, bool)
Create a job object given an existing Uuid.
Declaration
public QJob(Connection connection, Guid uuid, bool updateFromApi = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Connection | connection | The inner connection object. |
| Guid | uuid | The Uuid of an already existing job. |
| bool | updateFromApi | Update the job from api values (if true, will call compute API to retrieve job info) |
QJob(Connection, string, QPool, string, bool)
Create a new job.
Declaration
public QJob(Connection connection, string name, QPool pool = null, string shortname = null, bool UseTaskDependencies = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Connection | connection | The inner connection object. |
| string | name | The job name. |
| QPool | pool | The pool we want the job to be attached to. |
| string | shortname | The pool unique shortname. |
| bool | UseTaskDependencies | Bool to allow use of dependencies for tasks in this job. |
Fields
_api
Reference to the api connection.
Declaration
protected Connection _api
Field Value
| Type | Description |
|---|---|
| Connection |
_uri
The job resource uri.
Declaration
protected string _uri
Field Value
| Type | Description |
|---|---|
| string |
Properties
AutoDeleteOnCompletion
AutoDeleteOnCompletion: Field allowing the automatic deletion of the job when in a final state. Must be set before the submission.
Declaration
public bool AutoDeleteOnCompletion { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompletionTimeToLive
CompletionTimeToLive: Final State Duration before deletion of the job. Must be set before the submission.
Declaration
public TimeSpan CompletionTimeToLive { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Connection
The inner Connection object.
Declaration
public virtual Connection Connection { get; }
Property Value
| Type | Description |
|---|---|
| Connection |
CreationDate
The Job creation date
Declaration
public virtual DateTime CreationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
LastModified
The Job last modified date
Declaration
public virtual DateTime? LastModified { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
MaximumWallTime
Wall time limit for the job execution. Once this this time duration exceeded, the whole job will terminate and the tasks linked will be canceled
Declaration
public virtual TimeSpan MaximumWallTime { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Name
The Job name
Declaration
public virtual string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Pool
The pool the job is attached to null if the job is not attached to a pool.
Declaration
public virtual QPool Pool { get; }
Property Value
| Type | Description |
|---|---|
| QPool |
PoolUuid
The related pool uuid
Declaration
public virtual Guid PoolUuid { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
PreviousState
Retrieve the job previous state (see QJobStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual string PreviousState { get; }
Property Value
| Type | Description |
|---|---|
| string |
PreviousStateTransitionTime
Retrieve the job previous state transition utc time (see QJobStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual DateTime? PreviousStateTransitionTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Shortname
The Job unique shortname
Declaration
public virtual string Shortname { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
State
Retrieve the job state (see QJobStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual string State { get; }
Property Value
| Type | Description |
|---|---|
| string |
StateTransitionTime
Retrieve the job state transition utc time (see QJobStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual DateTime? StateTransitionTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Tags
The custom job tag list.
Declaration
public virtual List<string> Tags { get; }
Property Value
| Type | Description |
|---|---|
| List<string> |
UseDependencies
Boolean to indicate if the job use dependency behaviour. Need to be true to allow the use of dependencies for tasks in this job.
Declaration
public virtual bool UseDependencies { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Uuid
The job unique identifier. The Uuid is generated by the Api when the job is created.
Declaration
public virtual Guid Uuid { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
Methods
Delete(bool, CancellationToken)
Delete the job. If the job is active, the job is terminated and deleted.
Declaration
[Obsolete("Delete is deprecated, please use DeleteAsync instead.")]
public virtual void Delete(bool force = false, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | force | Optional boolean to force inner tasks to be deleted. |
| CancellationToken | cancellationToken | Optional token to cancel the request. |
DeleteAsync(bool, CancellationToken)
Delete the job. If the job is active, the job is terminated and deleted.
Declaration
public virtual Task DeleteAsync(bool force = false, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | force | Optional boolean to force inner tasks to be deleted. |
| CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task |
SetTags(params string[])
Set the a list of tags for the job.
Declaration
public virtual void SetTags(params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | tags | Job tags. |
Submit(CancellationToken)
Submit this job.
Declaration
[Obsolete("Submit is deprecated, please use SubmitAsync instead.")]
public virtual void Submit(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
SubmitAsync(CancellationToken)
Submit this job.
Declaration
public virtual Task SubmitAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task |
Terminate(CancellationToken)
Terminate an active job. (will cancel all remaining tasks)
Declaration
[Obsolete("Terminate is deprecated, please use TerminateAsync instead.")]
public virtual void Terminate(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
TerminateAsync(CancellationToken)
Terminate an active job. (will cancel all remaining tasks)
Declaration
public virtual Task TerminateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task |
UpdateStatus(CancellationToken)
Update this job.
Declaration
[Obsolete("UpdateStatus is deprecated, please use UpdateStatusAsync instead.")]
public virtual void UpdateStatus(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
UpdateStatusAsync(CancellationToken)
Update this job.
Declaration
public virtual Task UpdateStatusAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task |