From 6b52d4dbaaf367311f388192ffc2822a368cd630 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 21 Jan 2020 15:38:19 +0100 Subject: [PATCH] consistent parameter order --- src/ocean/OceanCompute.ts | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ocean/OceanCompute.ts b/src/ocean/OceanCompute.ts index 4bf943d..55f9206 100644 --- a/src/ocean/OceanCompute.ts +++ b/src/ocean/OceanCompute.ts @@ -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} Returns The service agreement ID, representation of `bytes32` ID. */ - public async order(datasetDid: string, consumerAccount: Account): Promise { + public async order(consumerAccount: Account, datasetDid: string): Promise { 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} Returns compute job ID + * @return {Promise} Returns compute job ID under status.jobId */ public async start( - agreementId: string, consumerAccount: Account, + agreementId: string, algorithmDid?: string, algorithmMeta?: MetaData - ): Promise { - const { jobId } = await this.ocean.brizo.computeService( + ): Promise { + 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} Returns the new status of a job */ public async stop( - agreementId: string, consumerAccount: Account, + agreementId: string, jobId: string - ): Promise { + ): Promise { 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} Returns the new status of a job */ public async delete( - agreementId: string, consumerAccount: Account, + agreementId: string, jobId: string - ): Promise { + ): Promise { 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} Returns the new status of a job */ public async restart( + consumerAccount: Account, agreementId: string, - jobId: string, - consumerAccount: Account - ): Promise { - await this.stop(agreementId, consumerAccount, jobId) - const result = await this.start(agreementId, consumerAccount, jobId) + jobId: string + ): Promise { + 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} Returns the DDO of the result asset. */