squid_py.ocean.ocean_compute module

class squid_py.ocean.ocean_compute.OceanCompute(keeper, ocean_agreements, ocean_auth, did_resolver)

Bases: object

Ocean assets class.

static build_cluster_attributes(cluster_type, url)
Parameters
  • cluster_type

  • url

Returns

static build_container_attributes(image, tag, checksum)
Parameters
  • image

  • tag

  • checksum

Returns

static build_server_attributes(server_id, server_type, cpu, gpu, memory, disk, max_run_time)
Parameters
  • server_id

  • server_type

  • cpu

  • gpu

  • memory

  • disk

  • max_run_time

Returns

static build_service_provider_attributes(provider_type, description, cluster, containers, servers)
Parameters
  • provider_type

  • description

  • cluster

  • containers

  • servers

Returns

static check_output_dict(output_def, consumer_account)
static create_compute_service_attributes(price, timeout, creator, date_published, provider_attributes)
Parameters
  • price

  • timeout

  • creator

  • date_published

  • provider_attributes

Returns

create_compute_service_descriptor(attributes)
Parameters

attributes

delete(agreement_id, job_id, account)
order(did, consumer_account, algorithm_did=None, algorithm_meta=None, output=None, provider_address=None)
Parameters
  • did

  • consumer_account

  • algorithm_did – str – the asset did (of algorithm type) which consist of did:op: and the assetId hex str (without 0x prefix)

  • algorithm_metaAlgorithmMetadata instance – metadata about the algorithm being run if algorithm is being used. This is ignored when algorithm_did is specified.

  • output – Output object to be used in publishing mechanism

  • provider_address – ethereum account address of provider (optional)

Returns

restart(agreement_id, job_id, account)
result(agreement_id, job_id, account)
start(agreement_id, did, consumer_account, algorithm_did=None, algorithm_meta=None, output=None, job_id=None)
Parameters
  • agreement_id – hexstr – representation of bytes32 id

  • did – str – asset DID of the dataset with the compute service

  • consumer_account – Account instance of the consumer ordering the service

  • algorithm_did – str – the asset did (of algorithm type) which consist of did:op: and the assetId hex str (without 0x prefix)

  • algorithm_metaAlgorithmMetadata instance – metadata about the algorithm being run if algorithm is being used. This is ignored when algorithm_did is specified.

  • output – dict object to be used in publishing mechanism, must define

  • job_id – str identifier of a compute job that was previously started and stopped (if supported by the provider’s backend)

Returns

str – id of compute job being executed

status(agreement_id, job_id, account)
stop(agreement_id, job_id, account)