@planqk/planqk-service-sdk 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/datapool.d.ts +11 -0
- package/dist/datapool.js +17 -0
- package/package.json +1 -1
- package/planqk/service/_version.py +1 -1
- package/pyproject.toml +1 -1
- package/src/datapool.ts +18 -0
- package/src/index.test.ts +29 -14
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum ReferenceType {
|
|
2
|
+
DATAPOOL = "DATAPOOL"
|
|
3
|
+
}
|
|
4
|
+
export interface DataPoolReference {
|
|
5
|
+
id: string;
|
|
6
|
+
ref: ReferenceType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Factory function to create DataPoolReference objects with ref always set to DATAPOOL.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withDataPoolReference(id: string): DataPoolReference;
|
package/dist/datapool.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReferenceType = void 0;
|
|
4
|
+
exports.withDataPoolReference = withDataPoolReference;
|
|
5
|
+
var ReferenceType;
|
|
6
|
+
(function (ReferenceType) {
|
|
7
|
+
ReferenceType["DATAPOOL"] = "DATAPOOL";
|
|
8
|
+
})(ReferenceType || (exports.ReferenceType = ReferenceType = {}));
|
|
9
|
+
/**
|
|
10
|
+
* Factory function to create DataPoolReference objects with ref always set to DATAPOOL.
|
|
11
|
+
*/
|
|
12
|
+
function withDataPoolReference(id) {
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
ref: ReferenceType.DATAPOOL,
|
|
16
|
+
};
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.
|
|
1
|
+
__version__ = "2.5.0"
|
package/pyproject.toml
CHANGED
package/src/datapool.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export enum ReferenceType {
|
|
2
|
+
DATAPOOL = "DATAPOOL"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface DataPoolReference {
|
|
6
|
+
id: string
|
|
7
|
+
ref: ReferenceType
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Factory function to create DataPoolReference objects with ref always set to DATAPOOL.
|
|
12
|
+
*/
|
|
13
|
+
export function withDataPoolReference(id: string): DataPoolReference {
|
|
14
|
+
return {
|
|
15
|
+
id,
|
|
16
|
+
ref: ReferenceType.DATAPOOL,
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/index.test.ts
CHANGED
|
@@ -2,29 +2,25 @@ import process from 'node:process'
|
|
|
2
2
|
import {test} from 'vitest'
|
|
3
3
|
import 'dotenv/config'
|
|
4
4
|
import {PlanqkServiceClient} from "./client";
|
|
5
|
+
import {withDataPoolReference} from "./datapool";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const consumerSecret = process.env.CONSUMER_SECRET
|
|
7
|
+
const tokenEndpoint = process.env.TOKEN_ENDPOINT
|
|
8
|
+
const serviceEndpoint = process.env.SERVICE_ENDPOINT
|
|
9
|
+
const consumerKey = process.env.CONSUMER_KEY
|
|
10
|
+
const consumerSecret = process.env.CONSUMER_SECRET
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
console.log(`Token endpoint: ${tokenEndpoint}`)
|
|
13
|
+
console.log(`Service endpoint: ${serviceEndpoint}`)
|
|
14
|
+
console.log(`Consumer key: ${consumerKey}`)
|
|
15
|
+
console.log(`Consumer secret: ${consumerSecret}`)
|
|
16
16
|
|
|
17
|
+
test.skip('integration test: coin toss', {timeout: 5 * 60 * 1000}, async () => {
|
|
17
18
|
const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
|
|
18
19
|
|
|
19
20
|
let serviceExecutions = await client.api().getServiceExecutions()
|
|
20
21
|
console.log(serviceExecutions)
|
|
21
22
|
|
|
22
23
|
const data = {n_coin_tosses: 2}
|
|
23
|
-
// const dataRef = {
|
|
24
|
-
// dataPoolId: "87cb778e-ac43-11ec-b909-0242ac120002",
|
|
25
|
-
// dataSourceDescriptorId: "87cb778e-ac43-11ec-b909-0242ac120002",
|
|
26
|
-
// fileId: "87cb778e-ac43-11ec-b909-0242ac120002"
|
|
27
|
-
// }
|
|
28
24
|
const params = {shots: 100}
|
|
29
25
|
|
|
30
26
|
let serviceExecution = await client.api().startExecution({data, params}, {timeoutInSeconds: 60})
|
|
@@ -54,3 +50,22 @@ test.skip('integration test', {timeout: 5 * 60 * 1000}, async () => {
|
|
|
54
50
|
serviceExecutions = await client.api().getServiceExecutions()
|
|
55
51
|
console.log(serviceExecutions)
|
|
56
52
|
})
|
|
53
|
+
|
|
54
|
+
test.skip('integration test: using data pools', {timeout: 5 * 60 * 1000}, async () => {
|
|
55
|
+
const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
|
|
56
|
+
|
|
57
|
+
const data = {file_to_read: "example.txt"}
|
|
58
|
+
const dataset = withDataPoolReference("89ae42e1-9697-4742-adfb-95bf018104c3")
|
|
59
|
+
|
|
60
|
+
let serviceExecution = await client.api().startExecution({data, dataset}, {timeoutInSeconds: 60})
|
|
61
|
+
console.log(serviceExecution)
|
|
62
|
+
|
|
63
|
+
const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"]
|
|
64
|
+
while (!finalStates.includes(serviceExecution.status!)) {
|
|
65
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!)
|
|
66
|
+
}
|
|
67
|
+
console.log(serviceExecution)
|
|
68
|
+
|
|
69
|
+
const logs = await client.api().getLogs(serviceExecution.id!)
|
|
70
|
+
console.log(logs)
|
|
71
|
+
})
|