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 async Task<IJobMonitor> BeginMonitorJobAsync(string jobId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
Returns
| Type | Description |
|---|---|
| Task<IJobMonitor> | Asynchronous |
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 async 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 async 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 |
DeleteJob(String)
Deletes a job.
Declaration
public void DeleteJob(string jobId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job id. |
DeleteJobAsync(String)
Deletes a job.
Declaration
public async Task DeleteJobAsync(string jobId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job id. |
Returns
| Type | Description |
|---|---|
| Task | The delete task. |
Remarks
The returned task ends when the job has been deleted with the backend services.
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 |
GetAppInfo()
Gets the application information.
Declaration
public async Task<string> GetAppInfo()
Returns
| Type | Description |
|---|---|
| Task<System.String> | A string containing information about the application. |
GetAuthInfo()
Gets the authentication information.
Declaration
public async 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 async Task<IEnumerable<string>> GetContainersAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | Names of containers the user has access to. |
GetContainerUri(String, Nullable<Int32>)
Gets the container URI to the given container.
Declaration
public Uri GetContainerUri(string containerName, int? days = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | containerName | Name of the container. |
| System.Nullable<System.Int32> | days | Number of days until the container (shared access signature) URI expires. |
Returns
| Type | Description |
|---|---|
| Uri | URI to the container including shared access signature, null if the container is not found. |
GetContainerUriAsync(String, Nullable<Int32>)
Gets the container URI to the given container.
Declaration
public async Task<Uri> GetContainerUriAsync(string containerName, int? days = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | containerName | Name of the container. |
| System.Nullable<System.Int32> | days | Number of days until the container (shared access signature) URI expires. |
Returns
| Type | Description |
|---|---|
| Task<Uri> | URI to the container including shared access signature, null if the container is not found. |
GetContainerUriReadOnly(String, Nullable<Int32>)
Gets the container URI to the given container, with read-only access permissions only.
Declaration
public Uri GetContainerUriReadOnly(string containerName, int? days = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | containerName | Name of the container. |
| System.Nullable<System.Int32> | days | Number of days until the container (shared access signature) URI expires. |
Returns
| Type | Description |
|---|---|
| Uri | Read-only URI to the container including shared access signature, null if the container is not found. |
GetContainerUriReadOnlyAsync(String, Nullable<Int32>)
Gets the container URI to the given container, with read-only access permissions only.
Declaration
public async Task<Uri> GetContainerUriReadOnlyAsync(string containerName, int? days = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | containerName | Name of the container. |
| System.Nullable<System.Int32> | days | Number of days until the container (shared access signature) URI expires. |
Returns
| Type | Description |
|---|---|
| Task<Uri> | Read-only URI to the container including shared access signature, null if the container is not found. |
GetIdentityNames()
Gets the identity names.
Declaration
public async Task<IEnumerable<string>> GetIdentityNames()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | A sequence of strings representing the identity name(s) of the user. |
GetJobProperties()
Gets job properties for all jobs of the authenticated user.
Declaration
public IEnumerable<JobProperties> GetJobProperties()
Returns
| Type | Description |
|---|---|
| IEnumerable<JobProperties> | A collection of job properties objects for the user's jobs. |
Remarks
Each job properties object contains the application properties that were set by the application prior to submitting the job, see Properties and can be accessed through the property indexer on DNVGL.One.Compute.Core.JobProperties.
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()
Gets job properties for all jobs of the authenticated user.
Declaration
public async Task<IEnumerable<JobProperties>> GetJobPropertiesAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<JobProperties>> | A collection of job properties objects for the user's jobs. |
Remarks
Each job properties object contains the application properties that were set by the application prior to submitting the job, see Properties and can be accessed through the property indexer on DNVGL.One.Compute.Core.JobProperties.
GetJobPropertiesAsync(String)
Gets job properties for the specified job.
Declaration
public async 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 Properties and can be accessed through the property indexer on JobProperties.
GetJobPropertiesInSegments(String)
Gets job properties of jobs in segments of the authenticated user for the specified continuation token.
Declaration
public JobPropertiesSegment GetJobPropertiesInSegments(string continuationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | continuationToken | An object representing a continuation token from the server when the operation returns a partial result. |
Returns
| Type | Description |
|---|---|
| JobPropertiesSegment | An instance of JobPropertiesSegment. |
Remarks
Each job properties object contains the application properties that were set by the application prior to submitting the job, see Properties and can be accessed through the property indexer on DNVGL.One.Compute.Core.JobProperties.
GetJobPropertiesInSegmentsAsync(String)
Gets job properties of jobs in segments of the authenticated user for the specified continuation token.
Declaration
public async Task<JobPropertiesSegment> GetJobPropertiesInSegmentsAsync(string continuationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | continuationToken | An object representing a continuation token from the server when the operation returns a partial result. |
Returns
| Type | Description |
|---|---|
| Task<JobPropertiesSegment> | An instance of JobPropertiesSegment. |
Remarks
Each job properties object contains the application properties that were set by the application prior to submitting the job, see Properties and can be accessed through the property indexer on DNVGL.One.Compute.Core.JobProperties.
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 async 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 async 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 async Task<IEnumerable<string>> GetRoles()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | A sequence of strings representing the roles of the user. |
GetSignalRUserToken(String, String)
Gets a SignalR user token.
Declaration
public string GetSignalRUserToken(string jobId, string userId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | userId | The user identifier. |
Returns
| Type | Description |
|---|---|
| System.String | A SignalR token identifying the user. |
GetSignalRUserTokenAsync(String, String)
Gets a SignalR user token.
Declaration
public async Task<string> GetSignalRUserTokenAsync(string jobId, string userId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | userId | The user identifier. |
Returns
| Type | Description |
|---|---|
| Task<System.String> | A SignalR token identifying the user. |
GetSignalRWorkerToken(String, String)
Gets a worker SignalR token.
Declaration
public string GetSignalRWorkerToken(string jobId, string userId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | userId | The user identifier. |
Returns
| Type | Description |
|---|---|
| System.String | A SignalR token for the worker. |
GetSignalRWorkerTokenAsync(String, String)
Gets a worker SignalR token.
Declaration
public async Task<string> GetSignalRWorkerTokenAsync(string jobId, string userId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | userId | The user identifier. |
Returns
| Type | Description |
|---|---|
| Task<System.String> | A SignalR token for the worker. |
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 async 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 async 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 async 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 Properties and can be accessed through the property indexer on WorkItemProperties.
GetWorkItemPropertiesAsync(String, String)
Gets application properties for the work item given by the jobId and workItemId.
Declaration
public async 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 async 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 async 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 async 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. |
GetWorkItemStorageInfo(String, String)
Gets storage information for all work items in the given job.
Declaration
public IEnumerable<WorkItemStorageInfo> GetWorkItemStorageInfo(string jobId, string containerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | containerName | Name of the container. |
Returns
| Type | Description |
|---|---|
| IEnumerable<WorkItemStorageInfo> | A collection of WorkItemStorageInfo, one for each work unit in the job, containing container URIs with a valid SAS tokens. |
Remarks
The returned storage information contains storage container URIs, with access (SAS) token to access the storage container that contains the result files from the work item. Only work items that have uploaded results to Result Lake will be listed.
GetWorkItemStorageInfoAsync(String, String)
Gets storage information for all work items in the given job.
Declaration
public async Task<IEnumerable<WorkItemStorageInfo>> GetWorkItemStorageInfoAsync(string jobId, string containerName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | jobId | The job identifier. |
| System.String | containerName | Name of the container. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<WorkItemStorageInfo>> | A collection of WorkItemStorageInfo, one for each work unit in the job, containing container URIs with a valid SAS tokens. |
Remarks
The returned storage information contains storage container URIs, with access (SAS) token to access the storage container that contains the result files from the work item. Only work items that have uploaded results to Result Lake will be listed.
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 identifier. |
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 async Task<IJobMonitor> SubmitJobAsync(Job job)
Parameters
| Type | Name | Description |
|---|---|---|
| Job | job | The job. |
Returns
| Type | Description |
|---|---|
| Task<IJobMonitor> | A job monitor. |
SubmitJobAsync(Job, CancellationToken)
Submits the specified job with the cancellation token as an asynchronous operation.
Declaration
public async 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. |