Class OneComputePlatformClient
Provides an HTTP REST client for the OneCompute Platform web API.
Inherited Members
Namespace: DNVGL.One.Compute.Platform.Client
Assembly: DNVGL.One.Compute.Platform.Client.dll
Syntax
public class OneComputePlatformClient : RestClientBase, IOneComputePlatformClient, IJobSchedulingClient, IJobScheduler
Constructors
View SourceOneComputePlatformClient(String, String)
Initializes a new instance of the OneComputePlatformClient class.
Declaration
public OneComputePlatformClient(string baseAddress, string token = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseAddress | The REST API base address. |
System.String | token | The authentication bearer token (not yet implemented). |
Properties
View SourceOptions
Gets or sets the client options.
Declaration
public OneComputePlatformClient.ClientOptions Options { get; set; }
Property Value
Type | Description |
---|---|
OneComputePlatformClient.ClientOptions | The options. |
PollingIntervalSeconds
Gets or sets the polling interval.
Declaration
public int PollingIntervalSeconds { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The polling interval in seconds. |
Methods
View SourceBeginMonitorJobAsync(String)
Begin monitoring the specified Job. Any job and work item event for this job will be pushed through the event handlers on the returned IJobMonitor.
Declaration
public Task<IJobMonitor> BeginMonitorJobAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task<IJobMonitor> | Asynchronous task |
Remarks
The returned task ends when observation has been set up.
CancelJob(String)
Cancels an executing job.
Declaration
public void CancelJob(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job id. |
CancelJobAsync(String)
Cancels an executing job.
Declaration
public Task CancelJobAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job id. |
Returns
Type | Description |
---|---|
Task | The cancel task. |
Remarks
The returned task ends when the job has been cancelled with the backend services.
CreateBlobUris(String, IEnumerable<String>)
Creates the BLOB uris for the given blobs.
Declaration
public IEnumerable<Uri> CreateBlobUris(string containerName, IEnumerable<string> blobPaths)
Parameters
Type | Name | Description |
---|---|---|
System.String | containerName | Name of the container. |
IEnumerable<System.String> | blobPaths | The BLOB paths. |
Returns
Type | Description |
---|---|
IEnumerable<Uri> | A set of URIs for the |
CreateBlobUrisAsync(String, IEnumerable<String>)
Creates the BLOB URIs for the given blob paths.
Declaration
public Task<IEnumerable<Uri>> CreateBlobUrisAsync(string containerName, IEnumerable<string> blobPaths)
Parameters
Type | Name | Description |
---|---|---|
System.String | containerName | Name of the container. |
IEnumerable<System.String> | blobPaths | The BLOB paths. |
Returns
Type | Description |
---|---|
Task<IEnumerable<Uri>> | A set of URIs for the |
EndMonitorJobAsync(String)
End monitoring the specified Job.
Declaration
public Task EndMonitorJobAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task | Asynchronous task |
GetAppInfo()
Gets the application information.
Declaration
public Task<string> GetAppInfo()
Returns
Type | Description |
---|---|
Task<System.String> | A string containing information about the application. |
GetAuthInfo()
Gets the authentication information.
Declaration
public Task<string> GetAuthInfo()
Returns
Type | Description |
---|---|
Task<System.String> | A string containing information about the authentication status of the current user. |
GetContainers()
Gets the containers the user has access to.
Declaration
public IEnumerable<string> GetContainers()
Returns
Type | Description |
---|---|
IEnumerable<System.String> | Names of containers the user has access to |
GetContainersAsync()
Gets the containers the user has access to.
Declaration
public Task<IEnumerable<string>> GetContainersAsync()
Returns
Type | Description |
---|---|
Task<IEnumerable<System.String>> | Names of containers the user has access to |
GetContainerUri(String)
Gets the container URI to the given container.
Declaration
public Uri GetContainerUri(string containerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | containerName | Name of the container. |
Returns
Type | Description |
---|---|
Uri | Uri to the container including access token |
GetContainerUriAsync(String)
Gets the container URI to the given container.
Declaration
public Task<Uri> GetContainerUriAsync(string containerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | containerName | Name of the container. |
Returns
Type | Description |
---|---|
Task<Uri> | Uri to the container including access token, null if the container is not found. |
GetIdentityNames()
Gets the identity names.
Declaration
public Task<IEnumerable<string>> GetIdentityNames()
Returns
Type | Description |
---|---|
Task<IEnumerable<System.String>> | A sequence of strings representing the identity name(s) of the user. |
GetJobProperties(String)
Gets job properties for the specified job.
Declaration
public JobProperties GetJobProperties(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
JobProperties | The job properties object. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetJobPropertiesAsync(String)
Gets job properties for the specified job.
Declaration
public Task<JobProperties> GetJobPropertiesAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task<JobProperties> | The job properties object, null if the job is not found. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetJobs()
Gets the jobs for the current authenticated user.
Declaration
public IEnumerable<JobInfo> GetJobs()
Returns
Type | Description |
---|---|
IEnumerable<JobInfo> | A sequence of JobInfo. |
GetJobsAsync()
Gets the jobs for the current user.
Declaration
public Task<IEnumerable<JobInfo>> GetJobsAsync()
Returns
Type | Description |
---|---|
Task<IEnumerable<JobInfo>> | A sequence of JobInfo. |
GetJobStatus(String)
Gets status info for the specified job.
Declaration
public JobInfo GetJobStatus(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
JobInfo | The job info object. |
GetJobStatusAsync(String)
Gets the status info for the specified job.
Declaration
public Task<JobInfo> GetJobStatusAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task<JobInfo> | The job info object, null if the job is not found. |
GetRoles()
Gets the roles of the authenticated user.
Declaration
public Task<IEnumerable<string>> GetRoles()
Returns
Type | Description |
---|---|
Task<IEnumerable<System.String>> | A sequence of strings representing the roles of the user. |
GetWorkItemInfo(String)
Gets status info for the work items for the specified job.
Declaration
public IEnumerable<WorkItemInfo> GetWorkItemInfo(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
IEnumerable<WorkItemInfo> | A sequence of WorkItemInfo, one for each work item in the job. |
GetWorkItemInfo(String, String)
Gets status info for the specified work item.
Declaration
public WorkItemInfo GetWorkItemInfo(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
WorkItemInfo | The work item status info object. |
GetWorkItemInfoAsync(String)
Gets the work item identifiers for the specified job.
Declaration
public Task<IEnumerable<WorkItemInfo>> GetWorkItemInfoAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WorkItemInfo>> | A sequence of work item identifiers, null if the job is not found. |
GetWorkItemInfoAsync(String, String)
Gets status info for the specified work item.
Declaration
public Task<WorkItemInfo> GetWorkItemInfoAsync(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
Task<WorkItemInfo> | The work item status info object, null if the work item is not found. |
GetWorkItemProperties(String)
Gets application properties for the work items of the specified job.
Declaration
public IEnumerable<WorkItemProperties> GetWorkItemProperties(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
IEnumerable<WorkItemProperties> | A sequence of DNVGL.One.Compute.Core.WorkItemProperties, one for each work item in the job. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetWorkItemProperties(String, String)
Gets application properties for the work item given by the jobId
and workItemId
.
Declaration
public WorkItemProperties GetWorkItemProperties(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
WorkItemProperties | A DNVGL.One.Compute.Core.WorkItemProperties instance for the given work item. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetWorkItemPropertiesAsync(String)
Gets application properties for the work items of the specified job.
Declaration
public Task<IEnumerable<WorkItemProperties>> GetWorkItemPropertiesAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WorkItemProperties>> | A sequence of WorkItemProperties, one for each work item in the job. If the job is not found, null is returned. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetWorkItemPropertiesAsync(String, String)
Gets application properties for the work item given by the jobId
and workItemId
.
Declaration
public Task<WorkItemProperties> GetWorkItemPropertiesAsync(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
Task<WorkItemProperties> | A DNVGL.One.Compute.Core.WorkItemProperties instance for the given work item. |
Remarks
This object contains the application properties that were set by the application
prior to submitting the job, see
GetWorkItemResult(String, String)
Gets the work item result for the specified work item.
Declaration
public Result GetWorkItemResult(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
Result | The Result of the specified work item. |
GetWorkItemResultAsync(String, String)
Gets the work item result for the specified work item.
Declaration
public Task<Result> GetWorkItemResultAsync(string jobId, string workItemId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workItemId | The work item identifier. |
Returns
Type | Description |
---|---|
Task<Result> | The Result of the specified work item, null if the work item is not found. |
GetWorkItemResults(String)
The get work item results.
Declaration
public IEnumerable<Result> GetWorkItemResults(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job id. |
Returns
Type | Description |
---|---|
IEnumerable<Result> | A sequence of Result objects, one for each work item in the given job. |
GetWorkItemResultsAsync(String)
Gets the work item results.
Declaration
public Task<IEnumerable<Result>> GetWorkItemResultsAsync(string jobId)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job id. |
Returns
Type | Description |
---|---|
Task<IEnumerable<Result>> | A sequence of Result, null if the job is not found. |
GetWorkItemStorageContainerUri(String, String, String)
Gets the work item storage container URI with access (SAS) token.
Declaration
public Uri GetWorkItemStorageContainerUri(string jobId, string workUnitId, string containerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workUnitId | The work unit identifier. |
System.String | containerName | Name of the container. |
Returns
Type | Description |
---|---|
Uri | A container URI with a valid SAS token. |
GetWorkItemStorageContainerUriAsync(String, String, String)
Gets the work item storage container URI with access (SAS) token.
Declaration
public Task<Uri> GetWorkItemStorageContainerUriAsync(string jobId, string workUnitId, string containerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | jobId | The job identifier. |
System.String | workUnitId | The work unit identifier. |
System.String | containerName | Name of the container. |
Returns
Type | Description |
---|---|
Task<Uri> | A container URI with a valid SAS token. |
SubmitJob(Job)
Submit the job for execution.
Declaration
public string SubmitJob(Job job)
Parameters
Type | Name | Description |
---|---|---|
Job | job | The job. |
Returns
Type | Description |
---|---|
System.String | Job id |
SubmitJobAsync(Job)
Submits the specified Job and returns a job monitor that allows the client to monitor the status and progress of the job. Any job and work item event for this job will be pushed through the event handlers on the returned IJobMonitor.
Declaration
public Task<IJobMonitor> SubmitJobAsync(Job job)
Parameters
Type | Name | Description |
---|---|---|
Job | job | The job. |
Returns
Type | Description |
---|---|
Task<IJobMonitor> | Job monitor |
SubmitJobAsync(Job, CancellationToken)
Submits the specified job with the cancellation token as an asynchronous operation.
Declaration
public Task<string> SubmitJobAsync(Job job, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Job | job | The job to submit. |
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<System.String> | A task object, holding the reference to the job, representing the asynchronous operation. |
Remarks
In the scenario of System.InvalidOperationException exception, the HTTP error code can be found in its message property. In the scenario of System.UnauthorizedAccessException exception, an additional detail about the request rejection may be found in inner-exception property pointing to ForbiddenException or PaymentRequiredException exception.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.InvalidOperationException | UserId was not specified, or failed to submit the specified job. |
System.UnauthorizedAccessException | The request is rejected by the server for various reasons. |