mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
consistent parameter order
This commit is contained in:
parent
04aa6d6700
commit
6b52d4dbaa
@ -36,11 +36,11 @@ export class OceanCompute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Starts an order of a compute service that is defined in an asset's services.
|
||||
* @param {string} datasetDid The DID of the dataset asset (of type `dataset`) to run the algorithm on.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} datasetDid The DID of the dataset asset (of type `dataset`) to run the algorithm on.
|
||||
* @return {Promise<string>} Returns The service agreement ID, representation of `bytes32` ID.
|
||||
*/
|
||||
public async order(datasetDid: string, consumerAccount: Account): Promise<string> {
|
||||
public async order(consumerAccount: Account, datasetDid: string): Promise<string> {
|
||||
const ddo: DDO = await this.ocean.assets.resolve(datasetDid)
|
||||
const { index } = ddo.findServiceByType('compute')
|
||||
|
||||
@ -55,19 +55,19 @@ export class OceanCompute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Start the execution of a compute job.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {string} algorithmDid The DID of the algorithm asset (of type `algorithm`) to run on the asset.
|
||||
* @param {MetaData} algorithmMeta Metadata about the algorithm being run if `algorithm` is being used. This is ignored when `algorithmDid` is specified.
|
||||
* @return {Promise<string>} Returns compute job ID
|
||||
* @return {Promise<ComputeJobStatus>} Returns compute job ID under status.jobId
|
||||
*/
|
||||
public async start(
|
||||
agreementId: string,
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
algorithmDid?: string,
|
||||
algorithmMeta?: MetaData
|
||||
): Promise<string> {
|
||||
const { jobId } = await this.ocean.brizo.computeService(
|
||||
): Promise<ComputeJobStatus> {
|
||||
const status = await this.ocean.brizo.computeService(
|
||||
'post',
|
||||
agreementId,
|
||||
consumerAccount,
|
||||
@ -75,21 +75,21 @@ export class OceanCompute extends Instantiable {
|
||||
algorithmMeta
|
||||
)
|
||||
|
||||
return jobId
|
||||
return status
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends a running compute job.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {string} jobId The ID of the compute job to be stopped
|
||||
* @return {Promise<ComputeJobStatus>} Returns the new status of a job
|
||||
*/
|
||||
public async stop(
|
||||
agreementId: string,
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<string> {
|
||||
): Promise<ComputeJobStatus> {
|
||||
const status = await this.ocean.brizo.computeService(
|
||||
'put',
|
||||
agreementId,
|
||||
@ -102,16 +102,16 @@ export class OceanCompute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Deletes a compute job and all resources associated with the job. If job is running it will be stopped first.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {string} jobId The ID of the compute job to be stopped
|
||||
* @return {Promise<ComputeJobStatus>} Returns the new status of a job
|
||||
*/
|
||||
public async delete(
|
||||
agreementId: string,
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<string> {
|
||||
): Promise<ComputeJobStatus> {
|
||||
const status = await this.ocean.brizo.computeService(
|
||||
'delete',
|
||||
agreementId,
|
||||
@ -124,18 +124,18 @@ export class OceanCompute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Ends a running compute job and starts it again.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {string} jobId The ID of the compute job to be stopped
|
||||
* @return {Promise<ComputeJobStatus>} Returns the new status of a job
|
||||
*/
|
||||
public async restart(
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
jobId: string,
|
||||
consumerAccount: Account
|
||||
): Promise<string> {
|
||||
await this.stop(agreementId, consumerAccount, jobId)
|
||||
const result = await this.start(agreementId, consumerAccount, jobId)
|
||||
jobId: string
|
||||
): Promise<ComputeJobStatus> {
|
||||
await this.stop(consumerAccount, agreementId, jobId)
|
||||
const result = await this.start(consumerAccount, agreementId, jobId)
|
||||
return result
|
||||
}
|
||||
|
||||
@ -163,8 +163,8 @@ export class OceanCompute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Returns the final result of a specific compute job published as an asset.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} agreementId The service agreement ID.
|
||||
* @param {string} jobId The ID of the compute job to be stopped.
|
||||
* @return {Promise<DDO>} Returns the DDO of the result asset.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user