1
0
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:
Matthias Kretschmann 2020-01-21 15:38:19 +01:00
parent 04aa6d6700
commit 6b52d4dbaa
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -36,11 +36,11 @@ export class OceanCompute extends Instantiable {
/** /**
* Starts an order of a compute service that is defined in an asset's services. * 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 {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. * @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 ddo: DDO = await this.ocean.assets.resolve(datasetDid)
const { index } = ddo.findServiceByType('compute') const { index } = ddo.findServiceByType('compute')
@ -55,19 +55,19 @@ export class OceanCompute extends Instantiable {
/** /**
* Start the execution of a compute job. * 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 {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 {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. * @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( public async start(
agreementId: string,
consumerAccount: Account, consumerAccount: Account,
agreementId: string,
algorithmDid?: string, algorithmDid?: string,
algorithmMeta?: MetaData algorithmMeta?: MetaData
): Promise<string> { ): Promise<ComputeJobStatus> {
const { jobId } = await this.ocean.brizo.computeService( const status = await this.ocean.brizo.computeService(
'post', 'post',
agreementId, agreementId,
consumerAccount, consumerAccount,
@ -75,21 +75,21 @@ export class OceanCompute extends Instantiable {
algorithmMeta algorithmMeta
) )
return jobId return status
} }
/** /**
* Ends a running compute job. * Ends a running compute job.
* @param {string} agreementId The service agreement ID.
* @param {Account} consumerAccount The account of the consumer ordering the service. * @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 * @param {string} jobId The ID of the compute job to be stopped
* @return {Promise<ComputeJobStatus>} Returns the new status of a job * @return {Promise<ComputeJobStatus>} Returns the new status of a job
*/ */
public async stop( public async stop(
agreementId: string,
consumerAccount: Account, consumerAccount: Account,
agreementId: string,
jobId: string jobId: string
): Promise<string> { ): Promise<ComputeJobStatus> {
const status = await this.ocean.brizo.computeService( const status = await this.ocean.brizo.computeService(
'put', 'put',
agreementId, 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. * 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 {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 * @param {string} jobId The ID of the compute job to be stopped
* @return {Promise<ComputeJobStatus>} Returns the new status of a job * @return {Promise<ComputeJobStatus>} Returns the new status of a job
*/ */
public async delete( public async delete(
agreementId: string,
consumerAccount: Account, consumerAccount: Account,
agreementId: string,
jobId: string jobId: string
): Promise<string> { ): Promise<ComputeJobStatus> {
const status = await this.ocean.brizo.computeService( const status = await this.ocean.brizo.computeService(
'delete', 'delete',
agreementId, agreementId,
@ -124,18 +124,18 @@ export class OceanCompute extends Instantiable {
/** /**
* Ends a running compute job and starts it again. * 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 {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 * @param {string} jobId The ID of the compute job to be stopped
* @return {Promise<ComputeJobStatus>} Returns the new status of a job * @return {Promise<ComputeJobStatus>} Returns the new status of a job
*/ */
public async restart( public async restart(
consumerAccount: Account,
agreementId: string, agreementId: string,
jobId: string, jobId: string
consumerAccount: Account ): Promise<ComputeJobStatus> {
): Promise<string> { await this.stop(consumerAccount, agreementId, jobId)
await this.stop(agreementId, consumerAccount, jobId) const result = await this.start(consumerAccount, agreementId, jobId)
const result = await this.start(agreementId, consumerAccount, jobId)
return result return result
} }
@ -163,8 +163,8 @@ export class OceanCompute extends Instantiable {
/** /**
* Returns the final result of a specific compute job published as an asset. * 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 {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. * @param {string} jobId The ID of the compute job to be stopped.
* @return {Promise<DDO>} Returns the DDO of the result asset. * @return {Promise<DDO>} Returns the DDO of the result asset.
*/ */