Skip to content

Commit

Permalink
Document "queue with parameters feature" (#749)
Browse files Browse the repository at this point in the history
* Document "queue with parameters feature"

* Add Makymilian Chwałek to AUTHORS
  • Loading branch information
mchwalek authored Aug 5, 2022
1 parent 6241506 commit a9bbbd9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Resque Scheduler authors
- Justin Weiss
- Les Hill
- Luke Rodgers
- Maksymilian Chwałek
- Manuel Meurer
- Matt Aimonetti
- Matt Simpson
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,38 @@ seconds past the minute).
A big shout out to [rufus-scheduler](http://github.com/jmettraux/rufus-scheduler)
for handling the heavy lifting of the actual scheduling engine.

##### Queue with parameters

It's possible to specify parameters, that must be given by the user when they manually queue the job. To enable this feature add `parameters` key to scheduled job definition.

```yaml
queue_documents_for_indexing:
cron: "0 0 * * *"
class: "QueueDocuments"
queue: high
args:
foo: "bar"
a: "b"
parameters:
foo:
description: "value of foo"
default: "baz"
description: "This job queues all content for indexing in solr"
```

One can use following options for each parameter:
* description - tooltip to be shown next to the parameter input
* default - prefilled value in the parameter input

**NOTE**: When sheduling the job, parameters are merged into job args. Assuming the example above and default parametr value, the job will be run with the following args:

```ruby
{"foo"=>"baz", "a"=>"b"}
```

**NOTE**: If user leaves the parameter value empty, it'll be sent as empty string.

#### Dynamic schedules

Dynamic schedules are programmatically set on a running `resque-scheduler`.
Expand Down

0 comments on commit a9bbbd9

Please sign in to comment.