From 7dba190f2a70fd2a512edd961ae97910065792ad Mon Sep 17 00:00:00 2001 From: Peter Kraft Date: Wed, 10 Jul 2024 14:08:14 -0700 Subject: [PATCH] Better Cloud ListWorkflows (#543) ListWorkflows is now filterable by workflow UUID so you can retrieve a specific workflow. --- packages/dbos-cloud/applications/manage-workflows.ts | 1 + packages/dbos-cloud/cli.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/dbos-cloud/applications/manage-workflows.ts b/packages/dbos-cloud/applications/manage-workflows.ts index d82ce7f4b..c47647c44 100644 --- a/packages/dbos-cloud/applications/manage-workflows.ts +++ b/packages/dbos-cloud/applications/manage-workflows.ts @@ -2,6 +2,7 @@ import axios, { AxiosError } from "axios"; import { handleAPIErrors, getCloudCredentials, getLogger, isCloudAPIErrorResponse, retrieveApplicationName } from "../cloudutils.js"; export interface ListWorkflowsInput { + workflow_uuids?: string[] // Specific workflow UUIDs to retrieve. workflow_name?: string; // The name of the workflow function authenticated_user?: string; // The user who ran the workflow. start_time?: string; // Timestamp in ISO 8601 format diff --git a/packages/dbos-cloud/cli.ts b/packages/dbos-cloud/cli.ts index f476c32ac..3ff8c991d 100755 --- a/packages/dbos-cloud/cli.ts +++ b/packages/dbos-cloud/cli.ts @@ -395,14 +395,16 @@ workflowCommands .description('List workflows from your application') .argument("[string]", "application name (Default: name from package.json)") .option('-l, --limit ', 'Limit the results returned', "10") - .option('-u, --user ', 'Retrieve workflows run by this user') + .option('-u, --workflowUUIDs ', 'Retrieve specific UUIDs') + .option('-U, --user ', 'Retrieve workflows run by this user') .option('-s, --start-time ', 'Retrieve workflows starting after this timestamp (ISO 8601 format)') .option('-e, --end-time ', 'Retrieve workflows starting before this timestamp (ISO 8601 format)') .option('-S, --status ', 'Retrieve workflows with this status (PENDING, SUCCESS, ERROR, RETRIES_EXCEEDED, or CANCELLED)') .option('-v, --application-version ', 'Retrieve workflows with this application version') - .action(async (appName: string | undefined, options: { limit?: string, appDir?: string, user?: string, startTime?: string, endTime?: string, status?: string, applicationVersion?: string }) => { + .action(async (appName: string | undefined, options: { limit?: string, appDir?: string, user?: string, startTime?: string, endTime?: string, status?: string, applicationVersion?: string, workflow_uuids?: string[] }) => { const input: ListWorkflowsInput = { limit: Number(options.limit), + workflow_uuids: options.workflow_uuids, authenticated_user: options.user, start_time: options.startTime, end_time: options.endTime,