2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-25 07:12:17 +08:00

[ci skip] Clarify terminology around 'state' and 'queue'

This commit is contained in:
Ken Hibino 2020-01-19 15:21:51 -08:00
parent 9e872a4cb4
commit 04983dc00f
9 changed files with 37 additions and 32 deletions

View File

@ -21,7 +21,7 @@ var delCmd = &cobra.Command{
Long: `Del (asynqmon del) will delete a task given an identifier. Long: `Del (asynqmon del) will delete a task given an identifier.
The command takes one argument which specifies the task to delete. The command takes one argument which specifies the task to delete.
The task should be in either scheduled, retry or dead queue. The task should be in either scheduled, retry or dead state.
Identifier for a task should be obtained by running "asynqmon ls" command. Identifier for a task should be obtained by running "asynqmon ls" command.
Example: asynqmon enq d:1575732274:bnogo8gt6toe23vhef0g`, Example: asynqmon enq d:1575732274:bnogo8gt6toe23vhef0g`,

View File

@ -18,13 +18,13 @@ var delallValidArgs = []string{"scheduled", "retry", "dead"}
// delallCmd represents the delall command // delallCmd represents the delall command
var delallCmd = &cobra.Command{ var delallCmd = &cobra.Command{
Use: "delall [queue name]", Use: "delall [state]",
Short: "Deletes all tasks from the specified queue", Short: "Deletes all tasks from the specified state",
Long: `Delall (asynqmon delall) will delete all tasks from the specified queue. Long: `Delall (asynqmon delall) will delete all tasks in the specified state.
The argument should be one of "scheduled", "retry", or "dead". The argument should be one of "scheduled", "retry", or "dead".
Example: asynqmon delall dead -> Deletes all tasks from the dead queue`, Example: asynqmon delall dead -> Deletes all dead tasks`,
ValidArgs: delallValidArgs, ValidArgs: delallValidArgs,
Args: cobra.ExactValidArgs(1), Args: cobra.ExactValidArgs(1),
Run: delall, Run: delall,
@ -60,12 +60,12 @@ func delall(cmd *cobra.Command, args []string) {
case "dead": case "dead":
err = r.DeleteAllDeadTasks() err = r.DeleteAllDeadTasks()
default: default:
fmt.Printf("error: `asynqmon delall [queue name]` only accepts %v as the argument.\n", delallValidArgs) fmt.Printf("error: `asynqmon delall [state]` only accepts %v as the argument.\n", delallValidArgs)
os.Exit(1) os.Exit(1)
} }
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("Deleted all tasks from %q queue\n", args[0]) fmt.Printf("Deleted all tasks in %q state\n", args[0])
} }

View File

@ -21,7 +21,7 @@ var enqCmd = &cobra.Command{
Long: `Enq (asynqmon enq) will enqueue a task given an identifier. Long: `Enq (asynqmon enq) will enqueue a task given an identifier.
The command takes one argument which specifies the task to enqueue. The command takes one argument which specifies the task to enqueue.
The task should be in either scheduled, retry or dead queue. The task should be in either scheduled, retry or dead state.
Identifier for a task should be obtained by running "asynqmon ls" command. Identifier for a task should be obtained by running "asynqmon ls" command.
The task enqueued by this command will be processed as soon as the task The task enqueued by this command will be processed as soon as the task

View File

@ -18,16 +18,16 @@ var enqallValidArgs = []string{"scheduled", "retry", "dead"}
// enqallCmd represents the enqall command // enqallCmd represents the enqall command
var enqallCmd = &cobra.Command{ var enqallCmd = &cobra.Command{
Use: "enqall [queue name]", Use: "enqall [state]",
Short: "Enqueues all tasks from the specified queue", Short: "Enqueues all tasks in the specified state",
Long: `Enqall (asynqmon enqall) will enqueue all tasks from the specified queue. Long: `Enqall (asynqmon enqall) will enqueue all tasks in the specified state.
The argument should be one of "scheduled", "retry", or "dead". The argument should be one of "scheduled", "retry", or "dead".
The tasks enqueued by this command will be processed as soon as it The tasks enqueued by this command will be processed as soon as it
gets dequeued by a processor. gets dequeued by a processor.
Example: asynqmon enqall dead -> Enqueues all tasks from the dead queue`, Example: asynqmon enqall dead -> Enqueues all dead tasks`,
ValidArgs: enqallValidArgs, ValidArgs: enqallValidArgs,
Args: cobra.ExactValidArgs(1), Args: cobra.ExactValidArgs(1),
Run: enqall, Run: enqall,
@ -64,12 +64,12 @@ func enqall(cmd *cobra.Command, args []string) {
case "dead": case "dead":
n, err = r.EnqueueAllDeadTasks() n, err = r.EnqueueAllDeadTasks()
default: default:
fmt.Printf("error: `asynqmon enqall [queue name]` only accepts %v as the argument.\n", enqallValidArgs) fmt.Printf("error: `asynqmon enqall [state]` only accepts %v as the argument.\n", enqallValidArgs)
os.Exit(1) os.Exit(1)
} }
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("Enqueued %d tasks from %q queue\n", n, args[0]) fmt.Printf("Enqueued %d tasks in %q state\n", n, args[0])
} }

View File

@ -17,11 +17,11 @@ import (
// killCmd represents the kill command // killCmd represents the kill command
var killCmd = &cobra.Command{ var killCmd = &cobra.Command{
Use: "kill [task id]", Use: "kill [task id]",
Short: "Sends a task to dead queue given an identifier", Short: "Kills a task given an identifier",
Long: `Kill (asynqmon kill) will send a task to dead queue given an identifier. Long: `Kill (asynqmon kill) will put a task in dead state given an identifier.
The command takes one argument which specifies the task to kill. The command takes one argument which specifies the task to kill.
The task should be in either scheduled or retry queue. The task should be in either scheduled or retry state.
Identifier for a task should be obtained by running "asynqmon ls" command. Identifier for a task should be obtained by running "asynqmon ls" command.
Example: asynqmon kill r:1575732274:bnogo8gt6toe23vhef0g`, Example: asynqmon kill r:1575732274:bnogo8gt6toe23vhef0g`,

View File

@ -18,13 +18,13 @@ var killallValidArgs = []string{"scheduled", "retry"}
// killallCmd represents the killall command // killallCmd represents the killall command
var killallCmd = &cobra.Command{ var killallCmd = &cobra.Command{
Use: "killall [queue name]", Use: "killall [state]",
Short: "Sends all tasks to dead queue from the specified queue", Short: "Update all tasks to dead state from the specified state",
Long: `Killall (asynqmon killall) will moves all tasks from the specified queue to dead queue. Long: `Killall (asynqmon killall) will update all tasks from the specified state to dead state.
The argument should be either "scheduled" or "retry". The argument should be either "scheduled" or "retry".
Example: asynqmon killall retry -> Moves all tasks from retry queue to dead queue`, Example: asynqmon killall retry -> Update all retry tasks to dead tasks`,
ValidArgs: killallValidArgs, ValidArgs: killallValidArgs,
Args: cobra.ExactValidArgs(1), Args: cobra.ExactValidArgs(1),
Run: killall, Run: killall,
@ -59,12 +59,12 @@ func killall(cmd *cobra.Command, args []string) {
case "retry": case "retry":
n, err = r.KillAllRetryTasks() n, err = r.KillAllRetryTasks()
default: default:
fmt.Printf("error: `asynqmon killall [queue name]` only accepts %v as the argument.\n", killallValidArgs) fmt.Printf("error: `asynqmon killall [state]` only accepts %v as the argument.\n", killallValidArgs)
os.Exit(1) os.Exit(1)
} }
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("Sent %d tasks to \"dead\" queue from %q queue\n", n, args[0]) fmt.Printf("Successfully updated %d tasks to \"dead\" state\n", n)
} }

View File

@ -24,7 +24,7 @@ var lsValidArgs = []string{"enqueued", "inprogress", "scheduled", "retry", "dead
// lsCmd represents the ls command // lsCmd represents the ls command
var lsCmd = &cobra.Command{ var lsCmd = &cobra.Command{
Use: "ls [task state]", Use: "ls [state]",
Short: "Lists tasks in the specified state", Short: "Lists tasks in the specified state",
Long: `Ls (asynqmon ls) will list all tasks in the specified state in a table format. Long: `Ls (asynqmon ls) will list all tasks in the specified state in a table format.
@ -77,7 +77,7 @@ func ls(cmd *cobra.Command, args []string) {
case "dead": case "dead":
listDead(r) listDead(r)
default: default:
fmt.Printf("error: `asynqmon ls [task state]` only accepts %v as the argument.\n", lsValidArgs) fmt.Printf("error: `asynqmon ls [state]` only accepts %v as the argument.\n", lsValidArgs)
os.Exit(1) os.Exit(1)
} }
} }

View File

@ -25,9 +25,9 @@ var password string
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
Use: "asynqmon", Use: "asynqmon",
Short: "A monitoring tool for asynq queues", Short: "A monitoring tool for asynq queues",
Long: `Asynqmon is a CLI tool to inspect and monitor queues managed by asynq package. Long: `Asynqmon is a CLI tool to inspect tasks and queues managed by asynq package.
Asynqmon has a few commands to query and mutate the current state of the queues. Use commands to query and mutate the current state of tasks and queues.
Monitoring commands such as "stats" and "ls" can be used in conjunction with the Monitoring commands such as "stats" and "ls" can be used in conjunction with the
"watch" command to continuously run the command at a certain interval. "watch" command to continuously run the command at a certain interval.

View File

@ -21,14 +21,19 @@ import (
// statsCmd represents the stats command // statsCmd represents the stats command
var statsCmd = &cobra.Command{ var statsCmd = &cobra.Command{
Use: "stats", Use: "stats",
Short: "Shows current state of the queues", Short: "Shows current state of the tasks and queues",
Long: `Stats (aysnqmon stats) will show the number of tasks in each queue at that instant. Long: `Stats (aysnqmon stats) will show the overview of tasks and queues at that instant.
It also displays basic information about the running redis instance.
To monitor the queues continuously, it's recommended that you run this Specifically, the command shows the following:
* Number of tasks in each state
* Number of tasks in each queue
* Aggregate data for the current day
* Basic information about the running redis instance
To monitor the tasks continuously, it's recommended that you run this
command in conjunction with the watch command. command in conjunction with the watch command.
Example: watch -n 5 asynqmon stats`, Example: watch -n 3 asynqmon stats -> Shows current state of tasks every three seconds`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
Run: stats, Run: stats,
} }