Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,17 @@ e.g.: `'[{"id":"cpu","amount":3},{"id":"ram","amount":16772672536},{"id":"disk",
- `--accept` option can be set to `true` or `false`. If it is set to `false` a prompt will be displayed to the user for manual accepting the payment before starting a compute job. If it is set to `true`, the compute job starts automatically, without user input.
- `output` is an optional stringified JSON object specifying a remote storage backend where job results will be uploaded. Supported types include S3, FTP, URL, Arweave, and IPFS. If omitted, results are stored on the node's local disk. e.g.: `'{"remoteStorage":{"type":"s3","s3Access":{"endpoint":"https://s3.amazonaws.com","region":"us-east-1","bucket":"my-results","objectKey":"jobs/result.tar","accessKeyId":"AKIA...","secretAccessKey":"..."}}}'`

**Raw (unpublished) datasets and algorithms:**

Instead of a DID, you can pass a full `ComputeAsset` (datasets) or `ComputeAlgorithm` (algorithm) JSON object with a `fileObject`, to run compute on raw data/algorithms that are not published as assets. Raw entries have no DID and are not ordered (no datatoken). DID-based and raw entries can be mixed within the datasets argument (the value must then be valid JSON, with DIDs quoted). JSON must be single-quoted on the shell.

- Raw algorithm against a published dataset that allows raw algorithms (`allowRawAlgorithm: true`):
`npm run cli startCompute -- did:op:dataset '{"fileObject":{"type":"url","url":"https://example.com/algo.py","method":"GET"},"meta":{"container":{"entrypoint":"python $ALGO","image":"oceanprotocol/algo_dockers","tag":"python-branin","checksum":"sha256:..."}}}' env1 900 paymentToken resources --accept true`
- Raw dataset(s) against a published algorithm:
`npm run cli startCompute -- '[{"fileObject":{"type":"url","url":"https://example.com/data.csv","method":"GET"}}]' did:op:algo env1 900 paymentToken resources --accept true`
- Mixed datasets (a published DID and a raw file):
`npm run cli startCompute -- '["did:op:dataset",{"fileObject":{"type":"ipfs","hash":"Qm..."}}]' did:op:algo env1 900 paymentToken resources --accept true`

---

**Start Free Compute:**
Expand All @@ -223,6 +234,8 @@ e.g.: `'[{"id":"cpu","amount":3},{"id":"ram","amount":16772672536},{"id":"disk",
(Options can be provided in any order.)

- `output` is an optional stringified JSON object specifying a remote storage backend where job results will be uploaded. Same format as `startCompute`.
- Like `startCompute`, the datasets and algorithm arguments accept raw `ComputeAsset`/`ComputeAlgorithm` JSON objects with a `fileObject` (no DID), and mixed DID + raw datasets. e.g.:
`npm run cli startFreeCompute did:op:dataset '{"fileObject":{"type":"url","url":"https://example.com/algo.py","method":"GET"},"meta":{"container":{"entrypoint":"python $ALGO","image":"oceanprotocol/algo_dockers","tag":"python-branin","checksum":"sha256:..."}}}' env1`

---

Expand Down
28 changes: 20 additions & 8 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,12 @@ export async function createCLI() {
.description("Starts a compute job")
.argument(
"<datasetDids>",
"Dataset DIDs (comma-separated) OR (empty array for none)"
"Dataset DIDs (comma-separated), an empty array for none, OR a JSON ComputeAsset object/array with a fileObject (raw datasets, no DID). Mixed input must be valid JSON, e.g. '[\"did:op:abc\",{\"fileObject\":{...}}]'"
)
.argument(
"<algoDid>",
"Algorithm DID, OR a JSON ComputeAlgorithm object with a fileObject and meta (raw algorithm, no DID)"
)
.argument("<algoDid>", "Algorithm DID")
.argument("<computeEnvId>", "Compute environment ID")
.argument("<maxJobDuration>", "maxJobDuration for compute job")
.argument("<paymentToken>", "Payment token for compute")
Expand All @@ -277,9 +280,12 @@ export async function createCLI() {
)
.option(
"-d, --datasets <datasetDids>",
"Dataset DIDs (comma-separated) OR (empty array for none)"
"Dataset DIDs (comma-separated), an empty array for none, OR a JSON ComputeAsset object/array with a fileObject (raw datasets, no DID)"
)
.option(
"-a, --algo <algoDid>",
"Algorithm DID, OR a JSON ComputeAlgorithm object with a fileObject and meta (raw algorithm, no DID)"
)
.option("-a, --algo <algoDid>", "Algorithm DID")
.option("-e, --env <computeEnvId>", "Compute environment ID")
.option("--maxJobDuration <maxJobDuration>", "Compute maxJobDuration")
.option("-t, --token <paymentToken>", "Compute payment token")
Expand Down Expand Up @@ -384,19 +390,25 @@ export async function createCLI() {
.description("Starts a FREE compute job")
.argument(
"<datasetDids>",
"Dataset DIDs (comma-separated) OR (empty array for none)"
"Dataset DIDs (comma-separated), an empty array for none, OR a JSON ComputeAsset object/array with a fileObject (raw datasets, no DID). Mixed input must be valid JSON, e.g. '[\"did:op:abc\",{\"fileObject\":{...}}]'"
)
.argument(
"<algoDid>",
"Algorithm DID, OR a JSON ComputeAlgorithm object with a fileObject and meta (raw algorithm, no DID)"
)
.argument("<algoDid>", "Algorithm DID")
.argument("<computeEnvId>", "Compute environment ID")
.argument(
"[output]",
"Output backend to save job results to. Supported types include S3, FTP, URL, Arweave, etc. Defaults to node local disk if omitted."
)
.option(
"-d, --datasets <datasetDids>",
"Dataset DIDs (comma-separated) OR (empty array for none)"
"Dataset DIDs (comma-separated), an empty array for none, OR a JSON ComputeAsset object/array with a fileObject (raw datasets, no DID)"
)
.option(
"-a, --algo <algoDid>",
"Algorithm DID, OR a JSON ComputeAlgorithm object with a fileObject and meta (raw algorithm, no DID)"
)
.option("-a, --algo <algoDid>", "Algorithm DID")
.option("-e, --env <computeEnvId>", "Compute environment ID")
.option(
"-o, --output [output]",
Expand Down
Loading
Loading