Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added experimental volume support for golem-js #1125

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

grisha87
Copy link
Contributor

Why?

The deployment-time volume definition parameter is introduced in exe-unit 0.5.2 and yagna 0.17. This PR adds the API access to that feature. It's marked as experimental because of the yagna 0.17 development status (RC right now).

Example

import {GolemNetwork} from "../src";

(async () => {
  const glm = new GolemNetwork({
    payment:{
      network: "holesky"
    }
  });

  try {
    console.log("Connecting to Golem Network")
    await glm.connect();

    console.log("Acquiring resources from the market")
    const rental = await glm.oneOf({
      order: {
        demand: {
          workload: {
            imageTag: "golem/node:latest",
            minStorageGib: 1,
            runtime: {
              version: "0.5.2"
            }
          }
        },
        market: {
          rentHours: 15/60,
          pricing: {
            avgGlmPerHour: 1,
            model: "burn-rate"
          },
        }
      },
      volumes: {
        data: {
          path: "/custom-data",
          sizeGib: 1
        },
        files: {
          path: "/custom-files",
          sizeGib: 1
        }
      }
    })

    console.log("Deployng workload to the rental")
    const exe = await rental.getExeUnit();

    console.log("Running command on the workload")
    const result = await exe.run("df -h");
    console.log(result.stdout?.toString());

    console.log("Finalizing the rental and releasing resources to the market")
    await rental.stopAndFinalize();
  }
  finally {
    await glm.disconnect();
  }
})().catch(console.error);

@grisha87 grisha87 merged commit d2e5f4b into beta Nov 18, 2024
8 checks passed
@grisha87 grisha87 deleted the feature/volume-definition branch November 18, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants