Skip to content

Commit

Permalink
Merge pull request #18 from golemfactory/feat/JST-773/pretty-logger
Browse files Browse the repository at this point in the history
feat(logger): added pinoLogger and pinoPrettyLogger as optional loggers for use in TaskExecutor
  • Loading branch information
mgordel authored Mar 6, 2024
2 parents 0c7dad2 + 5635c67 commit b530e13
Show file tree
Hide file tree
Showing 68 changed files with 359 additions and 74 deletions.
3 changes: 2 additions & 1 deletion examples/blender/blender.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
import { program } from "commander";
import { fileURLToPath } from "url";

Expand Down Expand Up @@ -29,6 +29,7 @@ async function main(subnetTag: string, driver?: string, network?: string, maxPar
payment: { driver, network },
package: "golem/blender:latest",
maxParallelTasks,
logger: pinoPrettyLogger(),
});

try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { TaskExecutor } = require("@golem-sdk/task-executor");
const { TaskExecutor, pinoPrettyLogger } = require("@golem-sdk/task-executor");

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
3 changes: 2 additions & 1 deletion examples/docs-examples/examples/executing-tasks/foreach.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
3 changes: 2 additions & 1 deletion examples/docs-examples/examples/executing-tasks/map.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
maxParallelTasks: 3,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
maxParallelTasks: 3,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

/**
* Example demonstrating how to write a custom proposal filter.
Expand Down Expand Up @@ -30,6 +30,7 @@ const myFilter = (proposal) => {
const executor = await TaskExecutor.create({
package: "9a3b5d67b0b27746283cb5f287c13eab1beaa12d92a9f536b747c7ae",
proposalFilter: myFilter,
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
startupTimeout: 60_000,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async function main() {
const executor = await TaskExecutor.create({
Expand All @@ -7,6 +7,7 @@ import { TaskExecutor } from "@golem-sdk/task-executor";
//minMemGib : 8,
//minStorageGib: 10,
minCpuThreads: 1,
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TaskExecutor, ProposalFilterFactory } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger, ProposalFilterFactory } from "@golem-sdk/task-executor";

/**
* Example demonstrating how to use the predefined filter `allowProvidersByName`,
Expand All @@ -15,6 +15,7 @@ for (let i = 0; i < whiteListNames.length; i++) {
const executor = await TaskExecutor.create({
package: "9a3b5d67b0b27746283cb5f287c13eab1beaa12d92a9f536b747c7ae",
proposalFilter: ProposalFilterFactory.allowProvidersByName(whiteListNames),
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
import { createHash } from "node:crypto";
import * as fs from "fs";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
payment: { network: "polygon" },
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
import { createHash } from "node:crypto";
import * as fs from "fs";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "dcd99a5904bebf7ca655a833b73cc42b67fd40b4a111572e3d2007c3",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
3 changes: 2 additions & 1 deletion examples/docs-examples/examples/using-app-keys/index.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
// replace 'try_golem' with 'insert-your-32-char-app-key-here'
yagnaOptions: { apiKey: "try_golem" },
});
Expand Down
3 changes: 2 additions & 1 deletion examples/docs-examples/examples/working-with-images/hash.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
4 changes: 3 additions & 1 deletion examples/docs-examples/examples/working-with-images/tag.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

const executor = await TaskExecutor.create({
package: "golem/alpine:latest",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";

(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});

Expand Down
3 changes: 2 additions & 1 deletion examples/docs-examples/quickstarts/quickstart/requestor.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
(async () => {
const executor = await TaskExecutor.create({
package: "529f7fdaf1cf46ce3126eb6bbcd3b213c314fe8fe884914f5d1106d4",
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
});
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TaskExecutor } from "@golem-sdk/task-executor";
import { TaskExecutor, pinoPrettyLogger } from "@golem-sdk/task-executor";
import { readFile } from "fs/promises";

const url = "https://ipfs.io/ipfs/bafybeihkoviema7g3gxyt6la7vd5ho32ictqbilu3wnlo3rs7ewhnp7lly";
Expand All @@ -10,6 +10,7 @@ const url = "https://ipfs.io/ipfs/bafybeihkoviema7g3gxyt6la7vd5ho32ictqbilu3wnlo
// Create and configure a TaskExecutor instance.
const executor = await TaskExecutor.create({
capabilities: ["inet", "manifest-support"],
logger: pinoPrettyLogger(),
yagnaOptions: { apiKey: "try_golem" },
manifest: manifest.toString("base64"),
});
Expand Down
Loading

0 comments on commit b530e13

Please sign in to comment.