Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- name: Run Barge
working-directory: ${{ github.workspace }}/barge
run: |
export NODE_VERSION=pr-950
bash -x start_ocean.sh --with-typesense 2>&1 > start_ocean.log &
- run: npm ci
- run: npm run build
Expand Down
4 changes: 2 additions & 2 deletions metadata/simpleComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"compute": {
"allowRawAlgorithm": false,
"allowNetworkAccess": true,
"publisherTrustedAlgorithmPublishers": [],
"publisherTrustedAlgorithms": []
"publisherTrustedAlgorithmPublishers": ["*"],
"publisherTrustedAlgorithms": ["*"]
}
}
],
Expand Down
75 changes: 36 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"dependencies": {
"@oasisprotocol/sapphire-paratime": "^1.3.2",
"@oceanprotocol/contracts": "^2.3.1",
"@oceanprotocol/ddo-js": "^0.0.8",
"@oceanprotocol/lib": "^4.1.3",
"@oceanprotocol/ddo-js": "^0.1.0",
"@oceanprotocol/lib": "^4.1.4",
"commander": "^13.1.0",
"cross-fetch": "^3.1.5",
"crypto-js": "^4.1.1",
Expand Down
4 changes: 4 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ export async function createCLI() {

const proceed = options.accept;
if (!proceed) {
if (!process.stdin.isTTY) {
console.error(chalk.red('Cannot prompt for confirmation (non-TTY). Use "--accept true" to skip.'));
process.exit(1);
}
const rl = createInterface({ input, output });
const confirmation = await rl.question(`\nProceed with payment for starting compute job at price ${amount} in tokens from address ${initResp.payment.token}? (y/n): `);
rl.close();
Expand Down
16 changes: 8 additions & 8 deletions test/consumeFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -81,7 +81,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -104,7 +104,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -127,7 +127,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/did:op:[a-f0-9]{64}/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find did in the output");
}

try {
Expand All @@ -145,7 +145,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -162,7 +162,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -179,7 +179,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -196,7 +196,7 @@ describe("Ocean CLI Publishing", function() {
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand Down
16 changes: 5 additions & 11 deletions test/paidComputeFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let computeDatasetDid: string;
let jsAlgoDid: string;
let computeEnvId: string;
let resources: any;

Check warning on line 18 in test/paidComputeFlow.test.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
let computeJobId: string;
let agreementId: string;

Expand Down Expand Up @@ -89,7 +89,7 @@
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -106,7 +106,7 @@
const jsonMatch = output.match(/s*([\s\S]*)/);
if (!jsonMatch) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
throw new Error("Could not find ddo in the output");
}

try {
Expand All @@ -125,18 +125,12 @@
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
}
const match = jsonMatch[0].match(/Exiting compute environments:\s*(.*)/s);
const result = match ? match[1].trim() : null;
if (!result) {
console.error("Raw output:", output);
throw new Error("Could not find compute environments in the output");
}


let environments;
try {
environments = eval(result);
environments = eval(jsonMatch[1]);
} catch (error) {
console.error(`Extracted output: ${jsonMatch[0]} and final result: ${result}`);
console.error(`Extracted output: ${jsonMatch[0]} and final result: ${jsonMatch[1]}`);
throw new Error("Failed to parse the extracted output:\n" + error);
}

Expand Down
Loading