Skip to content

Commit 1eb59bf

Browse files
authored
Provide better documentation and structure to EA workflow commands (#235)
* First pass * Update docs * Move run commands under unified command * Move to singular * Update command structure * Back to plural
1 parent 87305d6 commit 1eb59bf

8 files changed

Lines changed: 186 additions & 21 deletions

File tree

cmd/root.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ func isCI() bool {
9696

9797
func setupWorkflowCommands(deps *dependencies.Dependencies) {
9898
deps.Commands.Workflow.TaskListCmd = NewTaskListCmd(deps)
99-
deps.Commands.Workflow.TaskRunCmd = NewTaskRunCmd(deps)
99+
deps.Commands.Workflow.TaskRunCmd = NewTaskRunStartCmd(deps)
100100
deps.Commands.Workflow.TaskRunListCmd = NewTaskRunListCmd(deps)
101101
deps.Commands.Workflow.TaskRunDetailsCmd = NewTaskRunDetailsCmd(deps)
102102
deps.Commands.Workflow.VersionListCmd = NewVersionListCmd(deps)
103103
deps.Commands.Workflow.VersionReleaseCmd = NewVersionReleaseCmd(deps)
104104
deps.Commands.Workflow.WorkflowListCmd = workflowListCmd
105105

106106
taskCmd.AddCommand(deps.Commands.Workflow.TaskListCmd)
107-
taskCmd.AddCommand(deps.Commands.Workflow.TaskRunCmd)
108-
taskCmd.AddCommand(deps.Commands.Workflow.TaskRunListCmd)
107+
taskRunCmd.AddCommand(deps.Commands.Workflow.TaskRunCmd)
108+
taskRunCmd.AddCommand(deps.Commands.Workflow.TaskRunListCmd)
109+
taskRunCmd.AddCommand(deps.Commands.Workflow.TaskRunDetailsCmd)
109110
versionCmd.AddCommand(deps.Commands.Workflow.VersionListCmd)
110111
versionCmd.AddCommand(deps.Commands.Workflow.VersionReleaseCmd)
111-
deps.Commands.Workflow.TaskRunCmd.AddCommand(deps.Commands.Workflow.TaskRunDetailsCmd)
112112
}
113113

114114
func setupLogCommands(deps *dependencies.Dependencies) {

cmd/task.go

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,35 @@ const defaultTaskAPIPort = 8120
2828

2929
var taskCmd = &cobra.Command{
3030
Use: "tasks",
31-
Short: "Task commands",
31+
Short: "Manage tasks",
3232
}
3333

3434
var taskDevCmd = &cobra.Command{
35-
Use: "dev",
36-
Short: "Start a task in development mode",
35+
Use: "dev -- <command to start a workflow service>",
36+
Short: "Start a workflow service in development mode",
37+
Long: `Start a workflow service in development mode for local testing.
38+
39+
This command runs your workflow service locally on port 8120, allowing you to list and run
40+
tasks without deploying to Render. Task runs and their logs are stored in memory, so you
41+
can query them after tasks complete.
42+
43+
The command will spawn a new subprocess with your specified command whenever it needs to
44+
run a task or list the defined tasks.
45+
46+
To interact with the local task server:
47+
• Use the --local flag with other task commands (e.g., 'render tasks list --local')
48+
• Or set RENDER_USE_LOCAL_DEV=true when using the workflow client SDK
49+
50+
To use a different port:
51+
• Specify --port when starting the dev server
52+
• Then use --port with other task commands, or set RENDER_LOCAL_DEV_URL in the SDK
53+
54+
Examples:
55+
render ea tasks dev -- "go run main.go"
56+
render ea tasks dev --port 9000 -- "npm start"
57+
render ea tasks list --local
58+
render ea taskruns start my-task --local --input='["arg1"]'
59+
`,
3760
RunE: func(cmd *cobra.Command, args []string) error {
3861

3962
ctx := cmd.Context()
@@ -81,11 +104,33 @@ var taskDevCmd = &cobra.Command{
81104
Args: cobra.MinimumNArgs(1),
82105
}
83106

84-
func NewTaskRunCmd(deps flows.WorkflowDeps) *cobra.Command {
107+
func NewTaskRunStartCmd(deps flows.WorkflowDeps) *cobra.Command {
85108
cmd := &cobra.Command{
86-
Use: "run [taskID]",
87-
Short: "Run a new task",
88-
Args: cobra.MaximumNArgs(1),
109+
Use: "start [taskID] --input=<json>",
110+
Short: "Start a task run with the provided input",
111+
Long: `Start a task with the provided input.
112+
113+
You can specify the task by:
114+
• Task ID (e.g., tsk-1234)
115+
• Workflow slug and task name (e.g., my-workflow/my-task)
116+
117+
Input Format:
118+
The input should be a JSON array where each element is an argument to the task.
119+
For example, if your task takes two arguments, provide: ["arg1", "arg2"]
120+
121+
You can provide input via:
122+
• --input with inline JSON
123+
• --input-file with a path to a JSON file
124+
125+
In interactive mode, you will be prompted to select the task and provide the input.
126+
127+
Examples:
128+
render ea taskruns start tsk-1234 --input='["arg1", "arg2"]'
129+
render ea taskruns start my-workflow/my-task --input='[42, "hello"]'
130+
render ea taskruns start my-task --input-file=input.json
131+
render ea taskruns start my-task --local --input='["test"]'
132+
`,
133+
Args: cobra.MaximumNArgs(1),
89134
RunE: func(cmd *cobra.Command, args []string) error {
90135
deps, local, err := getLocalDeps(cmd, deps)
91136
if err != nil {
@@ -124,7 +169,10 @@ func NewTaskRunCmd(deps flows.WorkflowDeps) *cobra.Command {
124169
},
125170
}
126171

127-
cmd.Flags().String("input", "", "JSON input to pass to the task")
172+
cmd.Flags().String(
173+
"input", "",
174+
"JSON array input to pass to the task (e.g., '[\"arg1\", \"arg2\"]')",
175+
)
128176
cmd.Flags().String("input-file", "", "File containing JSON input to pass to the task")
129177
cmd.MarkFlagFilename("input-file")
130178

cmd/tasklist.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,25 @@ import (
1515
func NewTaskListCmd(deps flows.WorkflowDeps) *cobra.Command {
1616
taskListCmd := &cobra.Command{
1717
Use: "list [workflowVersionID]",
18-
Short: "List tasks for a workflow version",
19-
Args: cobra.MaximumNArgs(1),
18+
Short: "List tasks in a workflow version",
19+
Long: `List all tasks defined in a workflow version.
20+
21+
Tasks are user-defined functions registered with the Render workflow SDK. Each time you
22+
release a workflow service, Render creates a new workflow version and registers all tasks
23+
it finds in that version.
24+
25+
In interactive mode, you will be prompted to select a workflow version if not provided.
26+
27+
Local Development:
28+
When using the --local flag, you don't need to provide a workflow version ID. Instead,
29+
the command connects to your local dev server (default port 8120) to list tasks from
30+
your running workflow service. Start the dev server with 'render ea tasks dev' first.
31+
32+
Examples:
33+
render ea tasks list wfv-1234
34+
render ea tasks list --local
35+
`,
36+
Args: cobra.MaximumNArgs(1),
2037
RunE: func(cmd *cobra.Command, args []string) error {
2138
deps, local, err := getLocalDeps(cmd, deps)
2239
if err != nil {

cmd/taskrun.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cmd
2+
3+
import "github.com/spf13/cobra"
4+
5+
var taskRunCmd = &cobra.Command{
6+
Use: "taskruns",
7+
Short: "Manage task runs",
8+
Long: `Manage task run executions.
9+
10+
A task run represents a single execution of a task with specific input parameters.
11+
Use these commands to start new task runs, view their history, and inspect details.
12+
13+
Available commands:
14+
start - Execute a task with input parameters
15+
list - List all runs for a task
16+
show - Show detailed information about a specific run
17+
`,
18+
}
19+
20+
func init() {
21+
taskRunCmd.PersistentFlags().Bool("local", false, "Run against the server spawned by the task dev command")
22+
taskRunCmd.PersistentFlags().Int("port", defaultTaskAPIPort, "Port of the local task server (8120 when not specified)")
23+
24+
EarlyAccessCmd.AddCommand(taskRunCmd)
25+
}

cmd/taskrundetails.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@ import (
1313

1414
func NewTaskRunDetailsCmd(deps flows.WorkflowDeps) *cobra.Command {
1515
return &cobra.Command{
16-
Use: "details [taskRunID]",
17-
Short: "Get details for a task run",
16+
Use: "show [taskRunID]",
17+
Short: "Show detailed information about a task run",
18+
Long: `Display detailed information about a specific task run execution.
19+
20+
This command shows comprehensive information about a task run, including:
21+
• Task run ID and status
22+
• Input parameters provided
23+
• Output or error result
24+
• Start and completion timestamps
25+
26+
The task run ID is returned when you execute a task with 'render ea taskruns start'.
27+
28+
In interactive mode, you will be prompted to select a task run if not provided.
29+
30+
Examples:
31+
render ea taskruns show tr-1234
32+
render ea taskruns show --local tr-5678
33+
`,
1834
RunE: func(cmd *cobra.Command, args []string) error {
1935
deps, local, err := getLocalDeps(cmd, deps)
2036
if err != nil {

cmd/taskrunlist.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,25 @@ import (
1414

1515
func NewTaskRunListCmd(deps flows.WorkflowDeps) *cobra.Command {
1616
var taskRunListCmd = &cobra.Command{
17-
Use: "runs [taskID]",
17+
Use: "list [taskID]",
1818
Short: "List task runs for a task",
19-
Args: cobra.MaximumNArgs(1),
19+
Long: `List all execution runs for a specific task.
20+
21+
A task run represents a single execution of a task with specific input parameters.
22+
This command shows the history of all runs for a given task.
23+
24+
You can specify the task by:
25+
• Task ID (e.g., tsk-1234)
26+
• Workflow slug and task name (e.g., my-workflow/my-task)
27+
28+
In interactive mode, you will be prompted to select a task if not provided.
29+
30+
Examples:
31+
render ea taskruns list tsk-1234
32+
render ea taskruns list my-workflow/my-task
33+
render ea taskruns list --local my-task
34+
`,
35+
Args: cobra.MaximumNArgs(1),
2036
RunE: func(cmd *cobra.Command, args []string) error {
2137
deps, local, err := getLocalDeps(cmd, deps)
2238
if err != nil {

cmd/versionlist.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,25 @@ import (
1515
func NewVersionListCmd(deps flows.WorkflowDeps) *cobra.Command {
1616
var versionListCmd = &cobra.Command{
1717
Use: "list [workflowID]",
18-
Short: "List versions for a workflow",
19-
Args: cobra.MaximumNArgs(1),
18+
Short: "List versions of a workflow",
19+
Long: `List all versions of a workflow service.
20+
21+
Each time you release a workflow service, Render creates a new workflow version. A version
22+
represents a specific snapshot of your workflow service code and its registered tasks at
23+
the time of release.
24+
25+
This command displays all versions for a workflow, showing:
26+
• Version ID
27+
• Creation timestamp
28+
• Associated tasks
29+
30+
In interactive mode, you will be prompted to select a workflow if not provided.
31+
32+
Examples:
33+
render ea versions list wf-1234
34+
render ea versions list my-workflow-slug
35+
`,
36+
Args: cobra.MaximumNArgs(1),
2037
RunE: func(cmd *cobra.Command, args []string) error {
2138
var input workflowviews.VersionListInput
2239
err := command.ParseCommand(cmd, args, &input)

cmd/versionrelease.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,33 @@ func NewVersionReleaseCmd(deps flows.WorkflowDeps) *cobra.Command {
1717
var versionReleaseCmd = &cobra.Command{
1818
Use: "release [workflowID]",
1919
Short: "Release a new workflow version",
20-
Args: cobra.MaximumNArgs(1),
20+
Long: `Release a new version of a workflow service.
21+
22+
This command triggers a new release of your workflow service on Render. When you release,
23+
Render:
24+
1. Pulls the latest code from your repository (or a specific commit)
25+
2. Builds your workflow service
26+
3. Registers all tasks it finds in the service
27+
4. Creates a new workflow version
28+
29+
You can optionally specify a commit ID to release a specific version of your code.
30+
31+
Flags:
32+
--commit Specify a commit ID to release (optional)
33+
--wait Wait for the release to complete before returning (optional)
34+
Returns a non-zero exit code if the release fails
35+
36+
In interactive mode, you will be prompted to:
37+
• Select a workflow if not provided
38+
• Confirm the release
39+
40+
Examples:
41+
render ea versions release wf-1234
42+
render ea versions release my-workflow-slug
43+
render ea versions release wf-1234 --commit abc123
44+
render ea versions release wf-1234 --wait
45+
`,
46+
Args: cobra.MaximumNArgs(1),
2147
RunE: func(cmd *cobra.Command, args []string) error {
2248
var input workflowviews.VersionReleaseInput
2349
err := command.ParseCommand(cmd, args, &input)

0 commit comments

Comments
 (0)