Class AQTask
This class manges tasks life cycle: submission, monitor, delete.
Inherited Members
Namespace: QarnotSDK
Assembly: QarnotSDK.dll
Syntax
public abstract class AQTask
Fields
_api
Reference to the api connection.
Declaration
protected Connection _api
Field Value
Type | Description |
---|---|
Connection |
_uri
The task resource uri.
Declaration
protected string _uri
Field Value
Type | Description |
---|---|
string |
Properties
Connection
The inner Connection object.
Declaration
public virtual Connection Connection { get; }
Property Value
Type | Description |
---|---|
Connection |
Uuid
The task unique identifier. The Uuid is generated by the Api when the task is submitted.
Declaration
public virtual Guid Uuid { get; }
Property Value
Type | Description |
---|---|
Guid |
Methods
Abort(CancellationToken)
Abort a running task.
Declaration
[Obsolete("Abort is deprecated, please use AbortAsync instead.")]
public virtual void Abort(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
AbortAsync(CancellationToken)
Abort a running task.
Declaration
public virtual Task AbortAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyFreshOutputsToAsync(Stream, string, CancellationToken)
Copies the fresh new content of the outputs since the last call to the given stream.
Declaration
protected virtual Task CopyFreshOutputsToAsync(Stream destinationStream, string endpoint, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
string | endpoint | Endpoint from which to get the output content. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyFreshStderrTo(Stream, CancellationToken)
Copies the fresh new standard error since the last call to the given stream.
Declaration
[Obsolete("CopyFreshStderrTo is deprecated, please use CopyFreshStderrToAsync instead.")]
public virtual void CopyFreshStderrTo(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
CopyFreshStderrToAsync(Stream, uint?, CancellationToken)
Copies the fresh new standard error of the task instance since the last call to the given stream.
Declaration
public virtual Task CopyFreshStderrToAsync(Stream destinationStream, uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
uint? | instanceId | (optional) Id of the instance of which we want the fresh stderr. Will retrieve the fresh stderr of all instances if null |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyFreshStderrToAsync(Stream, CancellationToken)
Copies the fresh new standard error of the task instance since the last call to the given stream.
Declaration
public virtual Task CopyFreshStderrToAsync(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyFreshStdoutTo(Stream, CancellationToken)
Copies the fresh new standard output since the last call to the given stream.
Declaration
[Obsolete("CopyFreshStdoutTo is deprecated, please use CopyFreshStdoutToAsync instead.")]
public virtual void CopyFreshStdoutTo(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
CopyFreshStdoutToAsync(Stream, uint?, CancellationToken)
Copies the fresh new standard output of the task instance since the last call to the given stream.
Declaration
public virtual Task CopyFreshStdoutToAsync(Stream destinationStream, uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
uint? | instanceId | (optional) Id of the instance of which we want the fresh stdout. Will retrieve the fresh stdout of all instances if null |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyFreshStdoutToAsync(Stream, CancellationToken)
Copies the fresh new standard output since the last call to the given stream.
Declaration
public virtual Task CopyFreshStdoutToAsync(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyOutputsToAsync(Stream, string, CancellationToken)
Copies the full content of the outputs received from the endpoint to the given stream Note: the Content will rotate if it's too large
Declaration
protected virtual Task CopyOutputsToAsync(Stream destinationStream, string endpoint, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
string | endpoint | Endpoint from which to get the output content. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyStderrTo(Stream, CancellationToken)
Copies the full standard error to the given stream. Note: the standard error will rotate if it's too large.
Declaration
[Obsolete("CopyStderrTo is deprecated, please use CopyStderrToAsync instead.")]
public virtual void CopyStderrTo(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
CopyStderrToAsync(Stream, uint?, CancellationToken)
Copies the full standard error of the task instance to the given stream. Note: the standard error will rotate if it's too large.
Declaration
public virtual Task CopyStderrToAsync(Stream destinationStream, uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
uint? | instanceId | (optional) Id of the instance of which we want the stderr. Will retrieve the stderr of all instances if null |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyStderrToAsync(Stream, CancellationToken)
Copies the full standard error to the given stream. Note: the standard error will rotate if it's too large.
Declaration
public virtual Task CopyStderrToAsync(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyStdoutTo(Stream, CancellationToken)
Copies the full standard output to the given stream. Note: the standard output will rotate if it's too large.
Declaration
[Obsolete("CopyStdoutTo is deprecated, please use CopyStdoutToAsync instead.")]
public virtual void CopyStdoutTo(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
CopyStdoutToAsync(Stream, uint?, CancellationToken)
Copies the full standard output of the task instance to the given stream. Note: the standard output will rotate if it's too large.
Declaration
public virtual Task CopyStdoutToAsync(Stream destinationStream, uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
uint? | instanceId | (optional) Id of the instance of which we want the stdout. Will retrieve the stdout of all instances if null |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
CopyStdoutToAsync(Stream, CancellationToken)
Copies the full standard output to the given stream. Note: the standard output will rotate if it's too large.
Declaration
public virtual Task CopyStdoutToAsync(Stream destinationStream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The destination stream. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Delete(bool, bool, bool)
Delete the task. If the task is running, the task is aborted and deleted.
Declaration
[Obsolete("Delete is deprecated, please use DeleteAsync instead.")]
public virtual void Delete(bool failIfDoesntExist = false, bool purgeResources = false, bool purgeResults = false)
Parameters
Type | Name | Description |
---|---|---|
bool | failIfDoesntExist | If set to false and the task doesn't exist, no exception is thrown. Default is true. |
bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
bool | purgeResults | Boolean to trigger result storage deletion. Default is false. |
Delete(CancellationToken, bool, bool, bool)
Delete the task. If the task is running, the task is aborted and deleted.
Declaration
[Obsolete("Delete is deprecated, please use DeleteAsync instead.")]
public abstract void Delete(CancellationToken cancellationToken, bool failIfDoesntExist = false, bool purgeResources = false, bool purgeResults = false)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
bool | failIfDoesntExist | If set to false and the task doesn't exist, no exception is thrown. Default is true. |
bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
bool | purgeResults | Boolean to trigger result storage deletion. Default is false. |
DeleteAsync(bool, bool, bool)
Delete the task. If the task is running, the task is aborted and deleted.
Declaration
public virtual Task DeleteAsync(bool failIfDoesntExist = false, bool purgeResources = false, bool purgeResults = false)
Parameters
Type | Name | Description |
---|---|---|
bool | failIfDoesntExist | If set to false and the task doesn't exist, no exception is thrown. Default is true. |
bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
bool | purgeResults | Boolean to trigger result storage deletion. Default is false. |
Returns
Type | Description |
---|---|
Task |
DeleteAsync(CancellationToken, bool, bool, bool)
Delete the task. If the task is running, the task is aborted and deleted.
Declaration
public abstract Task DeleteAsync(CancellationToken cancellationToken, bool failIfDoesntExist = false, bool purgeResources = false, bool purgeResults = false)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
bool | failIfDoesntExist | If set to false and the task doesn't exist, no exception is thrown. Default is true. |
bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
bool | purgeResults | Boolean to trigger result storage deletion. Default is false. |
Returns
Type | Description |
---|---|
Task |
FreshStderr(CancellationToken)
Returns the fresh new standard error since the last call.
Declaration
[Obsolete("FreshStderr is deprecated, please use FreshStderrAsync instead.")]
public virtual string FreshStderr(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
string | The task fresh standard error. |
FreshStderrAsync(uint?, CancellationToken)
Returns the fresh new standard error of the task instance since the last call.
Declaration
public virtual Task<string> FreshStderrAsync(uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint? | instanceId | (optional) Id of the instance of which we want the fresh stderr. Will retrieve the fresh stderr of all instances if null. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The instance fresh standard error. |
FreshStderrAsync(CancellationToken)
Returns the fresh new standard error since the last call.
Declaration
public virtual Task<string> FreshStderrAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The task fresh standard error. |
FreshStdout(CancellationToken)
Returns the fresh new standard output since the last call.
Declaration
[Obsolete("FreshStdout is deprecated, please use FreshStdoutAsync instead.")]
public virtual string FreshStdout(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
string | The task fresh standard output. |
FreshStdoutAsync(uint?, CancellationToken)
Returns the fresh new standard output of the task instance since the last call.
Declaration
public virtual Task<string> FreshStdoutAsync(uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint? | instanceId | (optional) Id of the instance of which we want the fresh stdout. Will retrieve the fresh stdout of all instances if null. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The instance fresh standard output. |
FreshStdoutAsync(CancellationToken)
Returns the fresh new standard output since the last call.
Declaration
public virtual Task<string> FreshStdoutAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The task fresh standard output. |
Snapshot(CancellationToken)
Request made on a running task to sync the result files in $DOCKER_WORKDIR on the compute node to the result bucket. Note: There is no way to know when all the results are effectively transfered. This information is available by monitoring the task ResultsCount or by checking the result bucket.
Declaration
[Obsolete("Snapshot is deprecated, please use SnapshotAsync instead.")]
public virtual void Snapshot(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
SnapshotAsync(CancellationToken)
Request made on a running task to sync the result files in $DOCKER_WORKDIR on the compute node to the result bucket. Note: There is no way to know when all the results are effectively transfered. This information is available by monitoring the task ResultsCount or by checking the result bucket.
Declaration
public virtual Task SnapshotAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
SnapshotPeriodic(uint, CancellationToken)
Start a periodic snapshotting of the results.
Declaration
[Obsolete("SnapshotPeriodic is deprecated, please use SnapshotPeriodicAsync instead.")]
public virtual void SnapshotPeriodic(uint interval, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint | interval | Interval in seconds between two snapshots. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
SnapshotPeriodicAsync(uint, CancellationToken)
Start a periodic snapshotting of the results.
Declaration
public virtual Task SnapshotPeriodicAsync(uint interval, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint | interval | Interval in seconds between two snapshots. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
Stderr(CancellationToken)
Return the full standard error. Note: the standard error will rotate if it's too large.
Declaration
[Obsolete("Stderr is deprecated, please use StderrAsync instead.")]
public virtual string Stderr(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
string | The task standard error. |
StderrAsync(uint?, CancellationToken)
Return the full standard error of the task instance. Note: the standard error will rotate if it's too large.
Declaration
public virtual Task<string> StderrAsync(uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint? | instanceId | (optional) Id of the instance of which we want the stderr. Will retrieve the stderr of all instances if null. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The instance standard error. |
StderrAsync(CancellationToken)
Return the full standard error. Note: the standard error will rotate if it's too large.
Declaration
public virtual Task<string> StderrAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The task standard error. |
Stdout(CancellationToken)
Returns the full standard output. Note: the standard output will rotate if it's too large.
Declaration
[Obsolete("Stdout is deprecated, please use StdoutAsync instead.")]
public virtual string Stdout(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
string | The task standard output. |
StdoutAsync(uint?, CancellationToken)
Returns the full standard output of the task instance. Note: the standard output will rotate if it's too large.
Declaration
public virtual Task<string> StdoutAsync(uint? instanceId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint? | instanceId | (optional) Id of the instance of which we want the stdout. Will retrieve the stdout of all instances if null. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The instance standard output. |
StdoutAsync(CancellationToken)
Returns the full standard output. Note: the standard output will rotate if it's too large.
Declaration
public virtual Task<string> StdoutAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task<string> | The task standard output. |
TriggerPeriodicSnapshotAsync(uint, string, string, QBucket, string, CancellationToken)
Start a periodic snapshotting of the results with customized parameters. It can have a different whitelist, blacklist, bucket and bucket prefix than a normal snapshot.
Declaration
public virtual Task TriggerPeriodicSnapshotAsync(uint interval, string whitelist = null, string blacklist = null, QBucket bucket = null, string bucketPrefix = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
uint | interval | Interval in seconds between two snapshots. |
string | whitelist | Specify a custom whitelist for this periodic snapshot. |
string | blacklist | Specify a custom blacklist for this periodic snapshot. |
QBucket | bucket | Specify the name of a custom bucket for this periodic snapshot. |
string | bucketPrefix | Specify a custom prefix for this periodic snapshot. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
TriggerSnapshotAsync(string, string, QBucket, string, CancellationToken)
Start a snapshotting of the results with customized parameters. It can have a different whitelist, blacklist, bucket and bucket prefix than a normal snapshot.
Declaration
public virtual Task TriggerSnapshotAsync(string whitelist = null, string blacklist = null, QBucket bucket = null, string bucketPrefix = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | whitelist | Specify a custom whitelist for this snapshot. |
string | blacklist | Specify a custom blacklist for this snapshot. |
QBucket | bucket | Specify the name of a custom bucket this snapshot. |
string | bucketPrefix | Specify a custom prefix for this snapshot. |
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |
UpdateResources(CancellationToken)
Request made on a running task to re-sync the resource buckets to the compute nodes. 1 - Upload new files on your resource bucket, 2 - Call this method, 3 - The new files will appear on all the compute nodes in the $DOCKER_WORKDIR folder Note: There is no way to know when the files are effectively transfered. This information is available on the compute node only. Note: The update is additive only: files deleted from the bucket will NOT be deleted from the task's resources directory.
Declaration
[Obsolete("UpdateResources is deprecated, please use UpdateResourcesAsync instead.")]
public virtual void UpdateResources(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
UpdateResourcesAsync(CancellationToken)
Request made on a running task to re-sync the resource buckets to the compute nodes. 1 - Upload new files on your resource bucket, 2 - Call this method, 3 - The new files will appear on all the compute nodes in the $DOCKER_WORKDIR folder Note: There is no way to know when the files are effectively transfered. This information is available on the compute node only. Note: The update is additive only: files deleted from the bucket will NOT be deleted from the task's resources directory.
Declaration
public virtual Task UpdateResourcesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
Type | Description |
---|---|
Task |