Ocean Compute Tech Details
Technical details about OceanCompute functions
Using this class, we are able to manipulate a compute job, run it on Ocean environment and retrieve the results after the execution is finished.
Start Compute Job
start(
self,consumer_wallet,dataset: ComputeInput,compute_environment: str,algorithm: Optional[ComputeInput] = None,algorithm_meta: Optional[AlgorithmMetadata] = None,algorithm_algocustomdata: Optional[dict] = None,additional_datasets: List[ComputeInput] = []) ->str
Starts a compute job.
It can be called within Ocean Compute class.
Parameters
consumer_wallet- theeth Accountof consumer who pays & starts for compute job.dataset-ComputeInputobject, each of them includes mandatory the DDO and service.compute_environment-stringthat represents the ID from the chosen C2D environment.additional_datasets- list ofComputeInputobjects for additional datasets in case of starting a compute job for multiple datasets.
Optional parameters
algorithm-ComputeInputobject, each of them includes mandatory the DDO and service for algorithm.algorithm_meta- either provide just the algorithm metadata asAlgorithmMetadata.algorithm_algocustomedata- additional user data for the algorithm as dictionary.
Returns
str
Returns a string type job ID.
Defined in
Compute Job Status
status(
self,ddo: DDO,service: Service,job_id: str,wallet) ->Dict[str, Any]
Gets status of the compute job.
It can be called within Ocean Compute class.
Parameters
ddo- DDO offering the compute service of this jobservice- Service object of computejob_id- ID of the compute jobwallet- eth Account which initiated the compute job
Returns
Dict[str, Any]
A dictionary which contains the status for an existing compute job, keys are (ok, status, statusText).
Defined in
Compute Job Result
result(
self,ddo: DDO,service: Service,job_id: str,index: int,wallet) ->Dict[str, Any]
Gets compute job result.
It can be called within Ocean Compute class.
Parameters
ddo- DDO offering the compute service of this jobservice- Service object of computejob_id- ID of the compute jobindex- compute result indexwallet- eth Account which initiated the compute job
Returns
Dict[str, Any]
A dictionary wich contains the results/logs urls for an existing compute job, keys are (did, urls, logs).
Defined in
Compute Job Result Logs
compute_job_result_logs(
self,ddo: DDO,service: Service,job_id: str,wallet,log_type="output") ->Dict[str, Any]
Gets job output if exists.
It can be called within Ocean Compute class.
Parameters
ddo- DDO offering the compute service of this jobservice- Service object of computejob_id- ID of the compute jobwallet- eth Account which initiated the compute joblog_type- string which selects what kind of logs to display. Default "output"
Returns
Dict[str, Any]
A dictionary which includes the results/logs urls for an existing compute job, keys are (did, urls, logs).
Defined in
Stop Compute Job
stop(
self,ddo: DDO,service: Service,job_id: str,wallet) ->Dict[str, Any]
Attempts to stop the running compute job.
It can be called within Ocean Compute class.
Parameters
ddo- DDO offering the compute service of this jobservice- Service object of computejob_id- ID of the compute jobwallet- eth Account which initiated the compute job
Returns
Dict[str, Any]
A dictionary which contains the status for the stopped compute job, keys are (ok, status, statusText).
Defined in
Get Priced C2D Environments
get_c2d_environments(
self,service_endpoint: str,chain_id: int)
Get list of compute environments.
It can be called within Ocean Compute class.
Parameters
service_endpoint- string Provider URL that is stored in compute service.chain_id- using Provider multichain,chain_idis required to specify the network for your environment. It hasinttype.
Returns
list
A list of objects containing information about each compute environment. For each compute environment, these are the following keys: (id, feeToken, priceMin, consumerAddress, lastSeen, namespace, status).
Defined in
Get Free C2D Environments
get_free_c2d_environment(
self,service_endpoint: str,chain_id)
Get list of free compute environments.
Important thing is that not all Providers contain free environments (priceMin = 0).
It can be called within Ocean Compute class.
Parameters
service_endpoint- string Provider URL that is stored in compute service.chain_id- using Provider multichain,chain_idis required to specify the network for your environment. It hasinttype.
Returns
list
A list of objects containing information about each compute environment. For each compute environment, these are the following keys: (id, feeToken, priceMin, consumerAddress, lastSeen, namespace, status).
Defined in
Last updated
Was this helpful?

