Skip to main content

OceanProtocol Job Details

PyPI Coverage

A Python package to get details from OceanProtocol jobs

Installation

pip install oceanprotocol-job-details
#or
uv add oceanprotocol-job-details

Usage

As a simple library, we only need to import load_job_details and run it. It will:

  1. Read from disk the needed parameters to populate the JobDetails from the given base_dir. Looking for the files corresponding to the passed DIDs in the filesystem according to the Ocean Protocol Structure.
  2. If given a InputParameters type that inherits from pydantic.BaseModel, it will create an instance from the environment variables.

Minimal Example

from oceanprotocol_job_details import load_job_details

job_details = load_job_details({"base_dir": "...", "transformation_did": "..."})

Custom Input Parameters

If our algorithm has custom input parameters and we want to load them into our algorithm, we can do it as follows:

from pydantic import BaseModel
from oceanprotocol_job_details import load_job_details


class Foo(BaseModel):
    bar: str


class InputParameters(BaseModel):
    # Allows for nested types
    foo: Foo


job_details = load_job_details({"base_dir": "...", "transformation_did": "..."}, InputParameters)

# Usage
parameters = await job_details.input_parameters()
parameters.foo
parameters.foo.bar

The values to fill the custom InputParameters will be parsed from the algoCustomData.json located next to the input data directories.

Iterating Input Files the clean way

from oceanprotocol_job_details import load_job_details


job_details = load_job_details(...)

for idx, file_path in job_details.inputs():
    ...

_, file_path = next(job_details.inputs())

OceanProtocol Structure

data        # Root /data directory
├── ddos    # Contains the loaded dataset's DDO (metadata)
│   ├── 17feb...e42 # DDO file
│   └── ... # One DDO per loaded dataset
├── inputs  # Datasets dir
│   ├── 0   # Ocean Node >= 4.6: one folder per input, index-aligned with DIDS
│   │   └── parcels.csv
│   ├── 17feb...e42 # Older Ocean Node: folder named after the input DID
│   │   └── 0 # Data file
│   └── algoCustomData.json # Custom algorithm input data
├── logs    # Algorithm output logs dir
└── outputs # Algorithm output files dir

Note: Ocean Node >= 4.6 isolates each input in /data/inputs/<index>/ and sends the DIDS environment variable index-aligned with those folders (null for free-compute inputs without a DID). Older nodes used /data/inputs/<did>/. Both layouts are supported: the input folder is resolved by index first and by DID as a fallback.

Note: Even though it's possible that the algorithm is passed multiple datasets, right now the implementation only allows to use one dataset per algorithm execution, so normally the executing job will only have one ddo, one dir inside inputs, and one data file named 0.

Metadata

Release files for oceanprotocol-job-details 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oceanprotocol-job-details 0.5.3
File Size Uploaded Provenance Actions
oceanprotocol_job_details-0.5.3.tar.gz 10.0 kB Without provenance Details for oceanprotocol_job_details-0.5.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oceanprotocol-job-details 0.5.3
File Interpreter ABI Platform Actions
oceanprotocol_job_details-0.5.3-py3-none-any.whl Python 3 none any Details for oceanprotocol_job_details-0.5.3-py3-none-any.whl

Total release size: 26.9 kB

Release files / oceanprotocol_job_details-0.5.3.tar.gz

Download URL oceanprotocol_job_details-0.5.3.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6d9af1a97a01fdd0802303b624dab625631aea51c83305dec0046ab95e1a7763
BLAKE2b-256 checksum
How to use checksums
ebda666b85c98a09c4e36684c591b30f2f5b7b829b32158472a1bada924a7c37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / oceanprotocol_job_details-0.5.3-py3-none-any.whl

Download URL oceanprotocol_job_details-0.5.3-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5e493155a4538e7c9fb55c45d5781b4eb03da42036bfe855b0a875d69d5ed50
BLAKE2b-256 checksum
How to use checksums
b82a2b2c3137c6a5c94bd01d23e8a60a3bbaf2aceacd3a8fb9ba56be7f2620d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for oceanprotocol-job-details 0.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page