From 7d5586d7befaf270bd76d7baca59c7a9df2089ef Mon Sep 17 00:00:00 2001 From: Olga Botvinnik Date: Tue, 29 Oct 2024 14:12:39 -0700 Subject: [PATCH 1/3] List Workflows, not Runs --- components/seqera/seqera.app.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/seqera/seqera.app.mjs b/components/seqera/seqera.app.mjs index 7146bb522b90c..d81f7dc5e0a56 100644 --- a/components/seqera/seqera.app.mjs +++ b/components/seqera/seqera.app.mjs @@ -165,9 +165,9 @@ export default { ...args, }); }, - listRuns(args = {}) { + listWorkflows(args = {}) { return this._makeRequest({ - path: "/ga4gh/wes/v1/runs", + path: "/workflow?workspaceId=${workspaceId}", ...args, }); }, From 27a84f4d1c1f1c06b2232438eb114ac2a5f9b3e3 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 30 Oct 2024 11:42:44 -0400 Subject: [PATCH 2/3] updates --- .../actions/create-action/create-action.mjs | 2 +- .../create-compute-environment.mjs | 2 +- .../create-pipeline/create-pipeline.mjs | 2 +- components/seqera/package.json | 5 +++- components/seqera/seqera.app.mjs | 22 ++++++++-------- .../new-run-created/new-run-created.mjs | 25 +++++++++++++------ 6 files changed, 36 insertions(+), 22 deletions(-) diff --git a/components/seqera/actions/create-action/create-action.mjs b/components/seqera/actions/create-action/create-action.mjs index e87320d3ec6ec..c28c9f15a7876 100644 --- a/components/seqera/actions/create-action/create-action.mjs +++ b/components/seqera/actions/create-action/create-action.mjs @@ -6,7 +6,7 @@ export default { key: "seqera-create-action", name: "Create Pipeline Action", description: "Creates a new pipeline action in Seqera. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { app, diff --git a/components/seqera/actions/create-compute-environment/create-compute-environment.mjs b/components/seqera/actions/create-compute-environment/create-compute-environment.mjs index 66de51b4a7c74..7947f43f6b98f 100644 --- a/components/seqera/actions/create-compute-environment/create-compute-environment.mjs +++ b/components/seqera/actions/create-compute-environment/create-compute-environment.mjs @@ -5,7 +5,7 @@ export default { key: "seqera-create-compute-environment", name: "Create Compute Environment", description: "Creates a new compute environment in Seqera Tower. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { app, diff --git a/components/seqera/actions/create-pipeline/create-pipeline.mjs b/components/seqera/actions/create-pipeline/create-pipeline.mjs index bc9acb85fa5e5..b9dc787f2308e 100644 --- a/components/seqera/actions/create-pipeline/create-pipeline.mjs +++ b/components/seqera/actions/create-pipeline/create-pipeline.mjs @@ -5,7 +5,7 @@ export default { key: "seqera-create-pipeline", name: "Create Pipeline", description: "Creates a new pipeline in a user context. [See the documentation](https://docs.seqera.io/platform/23.3.0/api/overview)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { app, diff --git a/components/seqera/package.json b/components/seqera/package.json index adf038d81abe6..361247492f40b 100644 --- a/components/seqera/package.json +++ b/components/seqera/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/seqera", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Seqera Components", "main": "seqera.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/components/seqera/seqera.app.mjs b/components/seqera/seqera.app.mjs index d81f7dc5e0a56..03f2781fa6901 100644 --- a/components/seqera/seqera.app.mjs +++ b/components/seqera/seqera.app.mjs @@ -165,9 +165,11 @@ export default { ...args, }); }, - listWorkflows(args = {}) { + listWorkflows({ + workspaceId, ...args + }) { return this._makeRequest({ - path: "/workflow?workspaceId=${workspaceId}", + path: `/workflow?workspaceId=${workspaceId}`, ...args, }); }, @@ -177,18 +179,18 @@ export default { resourceName, max = constants.DEFAULT_MAX, }) { - let nextPageToken; + const params = { + ...resourcesFnArgs?.params, + max: constants.DEFAULT_LIMIT, + offset: 0, + }; let resourcesCount = 0; while (true) { const response = await resourcesFn({ ...resourcesFnArgs, - params: { - ...resourcesFnArgs?.params, - page_size: constants.DEFAULT_LIMIT, - page_token: nextPageToken, - }, + params, }); const nextResources = resourceName && response[resourceName] || response; @@ -207,12 +209,12 @@ export default { } } - if (Number(response.next_page_token) === 0) { + if (resourcesCount >= response.totalSize) { console.log("No more pages found"); return; } - nextPageToken = response.next_page_token; + params.offset += params.max; } }, paginate(args = {}) { diff --git a/components/seqera/sources/new-run-created/new-run-created.mjs b/components/seqera/sources/new-run-created/new-run-created.mjs index 8e95d55f3a6de..97b55910edce7 100644 --- a/components/seqera/sources/new-run-created/new-run-created.mjs +++ b/components/seqera/sources/new-run-created/new-run-created.mjs @@ -5,7 +5,7 @@ export default { key: "seqera-new-run-created", name: "New Run Created", 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)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { @@ -18,22 +18,31 @@ export default { intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, }, }, + workspaceId: { + propDefinition: [ + app, + "workspaceId", + ], + optional: false, + }, }, methods: { getResourceName() { - return "runs"; + return "workflows"; }, getResourcesFn() { - return this.app.listRuns; + return this.app.listWorkflows; }, getResourcesFnArgs() { - return; + return { + workspaceId: this.workspaceId, + }; }, - generateMeta(resource) { + generateMeta({ workflow }) { return { - id: resource.run_id, - summary: `New Run: ${resource.run_id}`, - ts: Date.now(), + id: workflow.id, + summary: `New Run: ${workflow.id}`, + ts: Date.parse(workflow.dateCreated), }; }, processResource(resource) { From d49694ffed3512931963673845635df8cd2063b8 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 30 Oct 2024 11:44:18 -0400 Subject: [PATCH 3/3] pnpm-lock.yaml --- pnpm-lock.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a234fe7037a27..cb67cab1018e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8934,7 +8934,10 @@ importers: slugify: 1.6.6 components/seqera: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/serpapi: specifiers: