1.14.5 • Published 3 months ago

@qarnot/sdk v1.14.5

Weekly downloads
27
License
Apache-2.0
Repository
github
Last release
3 months ago

Qarnot NodeJS SDK

Known Vulnerabilities Build status npm (scoped)

This package allows you to use Qarnot cloud computing service.

Installation

npm install @qarnot/sdk

Links

Usage

  • Create a Qarnot account and get your API token: Account.
  • Monitor your tasks and manage your data: Console.

  • SDK initialization

    const QarnotSDK = require('@qarnot/sdk');
    const Qarnot = new QarnotSDK({
        auth:'secret_token' // Retrieve your token from https://account.qarnot.com
        storage: {
          accessKeyId: 'email_address_of_user'
        }
    });

Run you first task !

await Qarnot.tasks.run({
  name: 'helloworld',
  profile: 'docker-batch',
  instanceCount: 4,
  constants: [{
    key: 'DOCKER_CMD',
    value: 'echo hello world from node ${INSTANCE_ID}!'
  }]
});
/* Output:
2> hello world from node 2!
1> hello world from node 1!
0> hello world from node 0!
3> hello world from node 3!
*/

NB. This method returns only when the task is completed. For long running task you might want to check the submit method

Create a task with resources

await Qarnot.buckets.createBucket('my-input-bucket');
await Qarnot.buckets.upload('my-input-bucket', 'input.txt', 'hello world !');
await Qarnot.buckets.createBucket('my-output-bucket');
await Qarnot.tasks.run({
  name: 'helloworld-withdata',
  profile: 'docker-batch',
  instanceCount: 1,
  resourceBuckets: [
    'my-input-bucket',
  ],
  resultBucket : 'my-output-bucket',
  constants: [{
    key: 'DOCKER_CMD',
    value: 'sh -c "cat input.txt | rev > output.txt"'
  }]
});
const result = await Qarnot.buckets.download('my-output-bucket', 'output.txt');
console.log(result.Body.toString());
/* Output:
! dlrow olleh
*/

Example

You can find examples in the test directory of the github repository

Contributions

Pull requests and github issues are welcome.

License

Licensed under Apache 2.0

1.14.5

3 months ago

1.14.3

5 months ago

1.14.1

8 months ago

1.14.0

9 months ago

1.13.1

9 months ago

1.14.2

7 months ago

1.12.1

12 months ago

1.12.0

1 year ago

1.11.3

1 year ago

1.11.2

1 year ago

1.11.1

2 years ago

1.11.0

2 years ago

1.10.0

2 years ago

1.10.3

2 years ago

1.10.2

2 years ago

1.10.1

2 years ago

1.8.2

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago