Skip to content

Commit e531d79

Browse files
olgabotmichelle0927
authored andcommitted
Seqera: List Workflows, not Runs (#14464)
* List Workflows, not Runs * updates * pnpm-lock.yaml --------- Co-authored-by: michelle0927 <michellelbergero@hotmail.com>
1 parent 20fbb39 commit e531d79

File tree

7 files changed

+40
-23
lines changed

7 files changed

+40
-23
lines changed

components/seqera/actions/create-action/create-action.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "seqera-create-action",
77
name: "Create Pipeline Action",
88
description: "Creates a new pipeline action in Seqera. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)",
9-
version: "0.0.1",
9+
version: "0.0.2",
1010
type: "action",
1111
props: {
1212
app,

components/seqera/actions/create-compute-environment/create-compute-environment.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "seqera-create-compute-environment",
66
name: "Create Compute Environment",
77
description: "Creates a new compute environment in Seqera Tower. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
app,

components/seqera/actions/create-pipeline/create-pipeline.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "seqera-create-pipeline",
66
name: "Create Pipeline",
77
description: "Creates a new pipeline in a user context. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "action",
1010
props: {
1111
app,

components/seqera/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/seqera",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Pipedream Seqera Components",
55
"main": "seqera.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
1518
}

components/seqera/seqera.app.mjs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,11 @@ export default {
165165
...args,
166166
});
167167
},
168-
listRuns(args = {}) {
168+
listWorkflows({
169+
workspaceId, ...args
170+
}) {
169171
return this._makeRequest({
170-
path: "/ga4gh/wes/v1/runs",
172+
path: `/workflow?workspaceId=${workspaceId}`,
171173
...args,
172174
});
173175
},
@@ -177,18 +179,18 @@ export default {
177179
resourceName,
178180
max = constants.DEFAULT_MAX,
179181
}) {
180-
let nextPageToken;
182+
const params = {
183+
...resourcesFnArgs?.params,
184+
max: constants.DEFAULT_LIMIT,
185+
offset: 0,
186+
};
181187
let resourcesCount = 0;
182188

183189
while (true) {
184190
const response =
185191
await resourcesFn({
186192
...resourcesFnArgs,
187-
params: {
188-
...resourcesFnArgs?.params,
189-
page_size: constants.DEFAULT_LIMIT,
190-
page_token: nextPageToken,
191-
},
193+
params,
192194
});
193195

194196
const nextResources = resourceName && response[resourceName] || response;
@@ -207,12 +209,12 @@ export default {
207209
}
208210
}
209211

210-
if (Number(response.next_page_token) === 0) {
212+
if (resourcesCount >= response.totalSize) {
211213
console.log("No more pages found");
212214
return;
213215
}
214216

215-
nextPageToken = response.next_page_token;
217+
params.offset += params.max;
216218
}
217219
},
218220
paginate(args = {}) {

components/seqera/sources/new-run-created/new-run-created.mjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "seqera-new-run-created",
66
name: "New Run Created",
77
description: "Emit new event when a new run is created in Seqera. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)",
8-
version: "0.0.1",
8+
version: "0.0.2",
99
type: "source",
1010
dedupe: "unique",
1111
props: {
@@ -18,22 +18,31 @@ export default {
1818
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
1919
},
2020
},
21+
workspaceId: {
22+
propDefinition: [
23+
app,
24+
"workspaceId",
25+
],
26+
optional: false,
27+
},
2128
},
2229
methods: {
2330
getResourceName() {
24-
return "runs";
31+
return "workflows";
2532
},
2633
getResourcesFn() {
27-
return this.app.listRuns;
34+
return this.app.listWorkflows;
2835
},
2936
getResourcesFnArgs() {
30-
return;
37+
return {
38+
workspaceId: this.workspaceId,
39+
};
3140
},
32-
generateMeta(resource) {
41+
generateMeta({ workflow }) {
3342
return {
34-
id: resource.run_id,
35-
summary: `New Run: ${resource.run_id}`,
36-
ts: Date.now(),
43+
id: workflow.id,
44+
summary: `New Run: ${workflow.id}`,
45+
ts: Date.parse(workflow.dateCreated),
3746
};
3847
},
3948
processResource(resource) {

pnpm-lock.yaml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)