-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from golemfactory/master
Master -> Beta sync
- Loading branch information
Showing
28 changed files
with
1,210 additions
and
1,462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
*.bin | ||
*.gvmi | ||
*.gvmi | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
examples/docs-examples/quickstarts/retrievable-task/task.mjs
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
examples/docs-examples/tool-examples/converting-Docker-image/Dockerfile
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:16-alpine | ||
COPY fibo.js /golem/work/ | ||
FROM node:18-alpine | ||
COPY dist/fibo.js /golem/work/ | ||
VOLUME /golem/input | ||
WORKDIR /golem/work | ||
WORKDIR /golem/work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { TaskExecutor } from "@golem-sdk/task-executor"; | ||
import { program } from "commander"; | ||
|
||
type MainOptions = { | ||
subnetTag: string; | ||
paymentDriver: string; | ||
paymentNetwork: string; | ||
tasksCount: number; | ||
fibonacciNumber: number; | ||
}; | ||
|
||
program | ||
.option("-n, --fibonacci-number <n>", "fibonacci number", "1") | ||
.option("-c, --tasks-count <c>", "tasks count", "1") | ||
.option("--subnet-tag <subnet>", "set subnet name, for example 'public'", "public") | ||
.option("--payment-driver, --driver <driver>", "payment driver name, for example 'erc20'", "erc20") | ||
.option("--payment-network, --network <network>", "network name, for example 'goerli'", "goerli") | ||
.action(async (options: MainOptions) => { | ||
const executor = await TaskExecutor.create({ | ||
package: "golem/js-fibonacci:latest", | ||
subnetTag: options.subnetTag, | ||
payment: { driver: options.paymentDriver, network: options.paymentNetwork }, | ||
}); | ||
|
||
const runningTasks: Promise<string | undefined>[] = []; | ||
for (let i = 0; i < options.tasksCount; i++) { | ||
runningTasks.push( | ||
executor.run(async (ctx) => { | ||
const result = await ctx.run("/usr/local/bin/node", [ | ||
"/golem/work/fibo.js", | ||
options.fibonacciNumber.toString(), | ||
]); | ||
console.log(result.stdout); | ||
return result.stdout?.toString().trim(); | ||
}), | ||
); | ||
} | ||
|
||
try { | ||
await Promise.all(runningTasks); | ||
} finally { | ||
await executor.shutdown(); | ||
} | ||
}); | ||
|
||
program.parse(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "golem/js-fibonacci", | ||
"description": "Example nodejs project that should end-up as a docker image that can be downloaded from the Golem Registry to be run on the provider", | ||
"version": "1.0.0", | ||
"repository": "https://github.com/golemfactory/golem-js", | ||
"private": true, | ||
"scripts": { | ||
"compile": "tsc", | ||
"image:build": "docker build -t $npm_package_name:latest .", | ||
"image:publish": "gvmkit-build --push $npm_package_name:latest", | ||
"build": "npm run compile && npm run image:build && npm run image:publish" | ||
}, | ||
"author": "GolemFactory <[email protected]>", | ||
"license": "LGPL-3.0", | ||
"devDependencies": { | ||
"typescript": "^5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, | ||
"module": "commonjs" /* Specify what module code is generated. */, | ||
"rootDir": "./src" /* Specify the root folder within your source files. */, | ||
"outDir": "./dist" /* Specify an output folder for all emitted files. */, | ||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, | ||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, | ||
"strict": true /* Enable all strict type-checking options. */, | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.