zizq 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/zizq/active_job_config.rb +39 -18
- data/lib/zizq/bulk_enqueue.rb +1 -1
- data/lib/zizq/client.rb +205 -7
- data/lib/zizq/crontab.rb +263 -0
- data/lib/zizq/crontab_builder.rb +52 -0
- data/lib/zizq/crontab_entry.rb +182 -0
- data/lib/zizq/crontab_entry_builder.rb +133 -0
- data/lib/zizq/enqueue_with.rb +1 -1
- data/lib/zizq/job.rb +6 -2
- data/lib/zizq/query.rb +2 -2
- data/lib/zizq/resources/cron_entry.rb +27 -0
- data/lib/zizq/resources/cron_group.rb +23 -0
- data/lib/zizq/resources/job.rb +4 -36
- data/lib/zizq/resources/job_template.rb +46 -0
- data/lib/zizq/resources.rb +3 -0
- data/lib/zizq/version.rb +1 -1
- data/lib/zizq.rb +108 -20
- data/sig/generated/zizq/active_job_config.rbs +19 -8
- data/sig/generated/zizq/bulk_enqueue.rbs +2 -2
- data/sig/generated/zizq/client.rbs +115 -0
- data/sig/generated/zizq/crontab.rbs +141 -0
- data/sig/generated/zizq/crontab_builder.rbs +35 -0
- data/sig/generated/zizq/crontab_entry.rbs +98 -0
- data/sig/generated/zizq/crontab_entry_builder.rbs +92 -0
- data/sig/generated/zizq/enqueue_with.rbs +2 -2
- data/sig/generated/zizq/query.rbs +4 -4
- data/sig/generated/zizq/resources/cron_entry.rbs +29 -0
- data/sig/generated/zizq/resources/cron_group.rbs +21 -0
- data/sig/generated/zizq/resources/job.rbs +4 -26
- data/sig/generated/zizq/resources/job_template.rbs +31 -0
- data/sig/generated/zizq.rbs +78 -4
- data/sig/zizq.rbs +24 -17
- metadata +20 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Generated from lib/zizq/crontab_builder.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
# Builder used to configure a Zizq::Crontab instance.
|
|
5
|
+
#
|
|
6
|
+
# Instances of this class are returned from `Zizq.define_crontab`. See
|
|
7
|
+
# documentation for that method for usage.
|
|
8
|
+
class CrontabBuilder
|
|
9
|
+
# The Crontab instance that this builder configures.
|
|
10
|
+
attr_reader target: Zizq::Crontab
|
|
11
|
+
|
|
12
|
+
# Optional timezone to be applied to all entries by default.
|
|
13
|
+
attr_accessor timezone: String?
|
|
14
|
+
|
|
15
|
+
# Initialize the builder with the given Crontab instance.
|
|
16
|
+
#
|
|
17
|
+
# @rbs target: Zizq::Crontab
|
|
18
|
+
# @rbs timezone: String?
|
|
19
|
+
# @rbs paused: bool?
|
|
20
|
+
def initialize: (Zizq::Crontab target, ?timezone: String?, ?paused: bool?) -> untyped
|
|
21
|
+
|
|
22
|
+
# Add or replace an entry on the schedule
|
|
23
|
+
#
|
|
24
|
+
# If no entry with the given name exists, it is added to schedule. If an
|
|
25
|
+
# entry with the same name exist, this entry replaces that entry. If the
|
|
26
|
+
# entry is the same as the original, the result is idempotent.
|
|
27
|
+
#
|
|
28
|
+
# @rbs name: String
|
|
29
|
+
# @rbs expression: String
|
|
30
|
+
# @rbs timezone: String?
|
|
31
|
+
# @rbs paused: bool?
|
|
32
|
+
# @rbs return: Zizq::CrontabEntryBuilder
|
|
33
|
+
def define_entry: (String name, String expression, ?timezone: String?, ?paused: bool?) -> Zizq::CrontabEntryBuilder
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Generated from lib/zizq/crontab_entry.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
# Represents a single entry within a Crontab schedule.
|
|
5
|
+
#
|
|
6
|
+
# Each entry specifies the cron expression at which it executes,
|
|
7
|
+
# information about when it last/next enqueued a job, and details of the
|
|
8
|
+
# job that the entry enqueues.
|
|
9
|
+
#
|
|
10
|
+
# Entries can be paused or resumed, and can be deleted or redefined in place.
|
|
11
|
+
class CrontabEntry
|
|
12
|
+
# The Crontab schedule to which this entry belongs.
|
|
13
|
+
attr_reader crontab: Zizq::Crontab
|
|
14
|
+
|
|
15
|
+
# The name of this entry within the schedule.
|
|
16
|
+
attr_reader name: String
|
|
17
|
+
|
|
18
|
+
# The cron expression used to define the schedule for the entry.
|
|
19
|
+
#
|
|
20
|
+
# Both standard 5-field and enhanced 6-field cron (with seconds) are
|
|
21
|
+
# supported, along with @daily, @weekly etc.
|
|
22
|
+
attr_reader expression: String
|
|
23
|
+
|
|
24
|
+
# The timezone in which the schedule entry is processed.
|
|
25
|
+
#
|
|
26
|
+
# Defaults to the Zizq server timezone unless specified.
|
|
27
|
+
attr_reader timezone: String?
|
|
28
|
+
|
|
29
|
+
# Parameters that will be used to enqueue jobs each time the schedule fires.
|
|
30
|
+
#
|
|
31
|
+
# These are the same parameters as those used to enqueue jobs normally.
|
|
32
|
+
attr_reader job: EnqueueRequest
|
|
33
|
+
|
|
34
|
+
# True if this entry is currrently paused.
|
|
35
|
+
attr_reader paused: bool?
|
|
36
|
+
|
|
37
|
+
# The timestamp at which this entry was last paused.
|
|
38
|
+
attr_reader paused_at: Float?
|
|
39
|
+
|
|
40
|
+
# The timestamp at which this entry was last resumed.
|
|
41
|
+
attr_reader resumed_at: Float?
|
|
42
|
+
|
|
43
|
+
# The timestamp at which a job was last enqueued for this entry.
|
|
44
|
+
attr_reader last_enqueue_at: Float?
|
|
45
|
+
|
|
46
|
+
#
|
|
47
|
+
# The timestamp at which the next job will be enqueued for this entry.
|
|
48
|
+
attr_reader next_enqueue_at: Float?
|
|
49
|
+
|
|
50
|
+
# Initialize the entry with all configured parameters.
|
|
51
|
+
#
|
|
52
|
+
# @rbs crontab: Zizq::Crontab
|
|
53
|
+
# @rbs name: String
|
|
54
|
+
# @rbs expression: String
|
|
55
|
+
# @rbs timezone: String?
|
|
56
|
+
# @rbs job: EnqueueRequest
|
|
57
|
+
# @rbs paused: bool?
|
|
58
|
+
# @rbs paused_at: Float?
|
|
59
|
+
# @rbs resumed_at: Float?
|
|
60
|
+
# @rbs last_enqueue_at: Float?
|
|
61
|
+
# @rbs next_enqueue_at: Float?
|
|
62
|
+
def initialize: (Zizq::Crontab crontab, String name, String expression, job: EnqueueRequest, ?timezone: String?, ?paused: bool?, ?paused_at: Float?, ?resumed_at: Float?, ?last_enqueue_at: Float?, ?next_enqueue_at: Float?) -> untyped
|
|
63
|
+
|
|
64
|
+
# Replace this entry with another.
|
|
65
|
+
#
|
|
66
|
+
# This is equivalent to calling `crontab.define_entry` with the same name.
|
|
67
|
+
#
|
|
68
|
+
# @rbs expression: String
|
|
69
|
+
# @rbs timezone: String?
|
|
70
|
+
# @rbs paused: bool?
|
|
71
|
+
# @rbs return: Zizq::CrontabEntryBuilder
|
|
72
|
+
def redefine: (String expression, ?timezone: String?, ?paused: bool?) -> Zizq::CrontabEntryBuilder
|
|
73
|
+
|
|
74
|
+
# Delete the entry from the schedule.
|
|
75
|
+
def delete!: () -> untyped
|
|
76
|
+
|
|
77
|
+
# Pause the entry within the schedule.
|
|
78
|
+
#
|
|
79
|
+
# This is independent of the paused state of the Crontab itself.
|
|
80
|
+
def pause!: () -> untyped
|
|
81
|
+
|
|
82
|
+
# Resume this entry if it is currently paused.
|
|
83
|
+
#
|
|
84
|
+
# If the parent Crontab itself is paused, the entry will still not enqueue
|
|
85
|
+
# jobs until the Crontab is resumed.
|
|
86
|
+
def resume!: () -> untyped
|
|
87
|
+
|
|
88
|
+
# @private
|
|
89
|
+
# @rbs return: Zizq::cron_entry_params
|
|
90
|
+
def to_params: () -> Zizq::cron_entry_params
|
|
91
|
+
|
|
92
|
+
private
|
|
93
|
+
|
|
94
|
+
# @rbs result: Zizq::Resources::CronEntry
|
|
95
|
+
# @rbs return: self
|
|
96
|
+
def materialize_with: (Zizq::Resources::CronEntry result) -> self
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Generated from lib/zizq/crontab_entry_builder.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
# Builder class used to define individual entries within a Crontab schedule.
|
|
5
|
+
#
|
|
6
|
+
# This is used internally by `Zizq.define_crontab`. See documentation for
|
|
7
|
+
# that method for full details.
|
|
8
|
+
#
|
|
9
|
+
# Callers *must* call one of the enqueue methods to complete the build
|
|
10
|
+
# process.
|
|
11
|
+
class CrontabEntryBuilder
|
|
12
|
+
# The Crontab instance onto which entries are applied.
|
|
13
|
+
attr_reader target: Zizq::Crontab
|
|
14
|
+
|
|
15
|
+
# The name of the entry being built.
|
|
16
|
+
attr_reader name: String
|
|
17
|
+
|
|
18
|
+
# The cron expression for the entry.
|
|
19
|
+
attr_reader expression: String
|
|
20
|
+
|
|
21
|
+
# Optional timezone for the entry.
|
|
22
|
+
#
|
|
23
|
+
# Defaults to the Zizq server timezone when not specified.
|
|
24
|
+
attr_reader timezone: String?
|
|
25
|
+
|
|
26
|
+
# True if this entry will be paused.
|
|
27
|
+
attr_reader paused: bool?
|
|
28
|
+
|
|
29
|
+
# Callback through which the built entry is passed before being added to
|
|
30
|
+
# the Crontab schedule.
|
|
31
|
+
#
|
|
32
|
+
# The callback receives the Zizq::CrontabEntry instance and may return an
|
|
33
|
+
# alternative instance to be used after it has done any processing on the
|
|
34
|
+
# entry.
|
|
35
|
+
attr_reader callback: ^(Zizq::CrontabEntry) -> Zizq::CrontabEntry
|
|
36
|
+
|
|
37
|
+
# Initialize the builder with the given inputs.
|
|
38
|
+
#
|
|
39
|
+
# @rbs target: Zizq::Crontab
|
|
40
|
+
# @rbs name: String
|
|
41
|
+
# @rbs expression: String
|
|
42
|
+
# @rbs timezone: String?
|
|
43
|
+
# @rbs paused: bool?
|
|
44
|
+
# @rbs ?&block: (Zizq::CrontabEntry) -> Zizq::CrontabEntry
|
|
45
|
+
def initialize: (Zizq::Crontab target, String name, String expression, ?timezone: String?, ?paused: bool?) ?{ (?) -> untyped } -> untyped
|
|
46
|
+
|
|
47
|
+
# Enqueue a Zizq::Job or ActiveJob class using Zizq::ActiveJobConfig via
|
|
48
|
+
# this entry.
|
|
49
|
+
#
|
|
50
|
+
# @rbs job_class: Class & Zizq::JobConfig
|
|
51
|
+
# @rbs args: Array[untyped]
|
|
52
|
+
# @rbs kwargs: Hash[Symbol, untyped]
|
|
53
|
+
# @rbs &block: ?(EnqueueRequest) -> void
|
|
54
|
+
# @rbs return: void
|
|
55
|
+
def enqueue: (Class & Zizq::JobConfig job_class, *untyped args, **untyped kwargs) ?{ (EnqueueRequest) -> void } -> void
|
|
56
|
+
|
|
57
|
+
# Process a raw job enqueue for this entry.
|
|
58
|
+
#
|
|
59
|
+
# This is used for low-level or cross-language support.
|
|
60
|
+
#
|
|
61
|
+
# @rbs queue: String
|
|
62
|
+
# @rbs type: String
|
|
63
|
+
# @rbs payload: untyped
|
|
64
|
+
# @rbs priority: Integer?
|
|
65
|
+
# @rbs ready_at: Zizq::to_f?
|
|
66
|
+
# @rbs retry_limit: Integer?
|
|
67
|
+
# @rbs backoff: Zizq::backoff?
|
|
68
|
+
# @rbs retention: Zizq::retention?
|
|
69
|
+
# @rbs unique_key: String?
|
|
70
|
+
# @rbs unique_while: Zizq::unique_scope?
|
|
71
|
+
# @rbs return: void
|
|
72
|
+
def enqueue_raw: (queue: String, type: String, payload: untyped, **untyped opts) -> void
|
|
73
|
+
|
|
74
|
+
# Bulk enqueues are not supported via cron.
|
|
75
|
+
#
|
|
76
|
+
# @rbs &block: (BulkEnqueue) -> void
|
|
77
|
+
# @rbs return: self
|
|
78
|
+
def enqueue_bulk: () { (BulkEnqueue) -> void } -> self
|
|
79
|
+
|
|
80
|
+
# Provide common fields to be used when enqueueing a job.
|
|
81
|
+
#
|
|
82
|
+
# @rbs overrides: Hash[Symbol, untyped]
|
|
83
|
+
# @rbs return: EnqueueWith
|
|
84
|
+
def enqueue_with: (**untyped overrides) -> EnqueueWith
|
|
85
|
+
|
|
86
|
+
private
|
|
87
|
+
|
|
88
|
+
# @rbs job: EnqueueRequest
|
|
89
|
+
# @rbs return: untyped
|
|
90
|
+
def push_entry: (untyped req) -> untyped
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -58,12 +58,12 @@ module Zizq
|
|
|
58
58
|
# Enqueue a job class via the underlying target, applying the scoped
|
|
59
59
|
# overrides before invoking any caller-supplied block.
|
|
60
60
|
#
|
|
61
|
-
# @rbs job_class: Class & Zizq::
|
|
61
|
+
# @rbs job_class: Class & Zizq::JobConfig
|
|
62
62
|
# @rbs args: Array[untyped]
|
|
63
63
|
# @rbs kwargs: Hash[Symbol, untyped]
|
|
64
64
|
# @rbs &block: ?(EnqueueRequest) -> void
|
|
65
65
|
# @rbs return: untyped
|
|
66
|
-
def enqueue: (Class & Zizq::
|
|
66
|
+
def enqueue: (Class & Zizq::JobConfig job_class, *untyped args, **untyped kwargs) ?{ (EnqueueRequest) -> void } -> untyped
|
|
67
67
|
|
|
68
68
|
# Enqueue a raw request via the underlying target, with overrides
|
|
69
69
|
# merged into the kwargs (explicit kwargs take precedence).
|
|
@@ -118,11 +118,11 @@ module Zizq
|
|
|
118
118
|
# Sets the type filter to the class name and adds a jq payload filter
|
|
119
119
|
# for an exact match of the serialized arguments.
|
|
120
120
|
#
|
|
121
|
-
# @rbs job_class: Zizq::
|
|
121
|
+
# @rbs job_class: Class && Zizq::JobConfig
|
|
122
122
|
# @rbs *args: untyped
|
|
123
123
|
# @rbs **kwargs: untyped
|
|
124
124
|
# @rbs return: Query
|
|
125
|
-
def by_job_class_and_args: (
|
|
125
|
+
def by_job_class_and_args: (untyped job_class, *untyped args, **untyped kwargs) -> Query
|
|
126
126
|
|
|
127
127
|
# Filter by job class and a subset of arguments.
|
|
128
128
|
#
|
|
@@ -132,11 +132,11 @@ module Zizq
|
|
|
132
132
|
# The job class must include `Zizq::Job` or for Active Job classes must
|
|
133
133
|
# extend `Zizq::ActiveJobConfig`.
|
|
134
134
|
#
|
|
135
|
-
# @rbs job_class: Zizq::
|
|
135
|
+
# @rbs job_class: Class & Zizq::JobConfig
|
|
136
136
|
# @rbs *args: untyped
|
|
137
137
|
# @rbs **kwargs: untyped
|
|
138
138
|
# @rbs return: Query
|
|
139
|
-
def by_job_class_and_args_subset: (Zizq::
|
|
139
|
+
def by_job_class_and_args_subset: (Class & Zizq::JobConfig job_class, *untyped args, **untyped kwargs) -> Query
|
|
140
140
|
|
|
141
141
|
# Replace the jq payload filter expression.
|
|
142
142
|
#
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Generated from lib/zizq/resources/cron_entry.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
module Resources
|
|
5
|
+
# Typed wrapper around a cron entry response hash.
|
|
6
|
+
class CronEntry < Resource
|
|
7
|
+
def name: () -> untyped
|
|
8
|
+
|
|
9
|
+
def expression: () -> untyped
|
|
10
|
+
|
|
11
|
+
def timezone: () -> untyped
|
|
12
|
+
|
|
13
|
+
def paused: () -> untyped
|
|
14
|
+
|
|
15
|
+
def paused?: () -> untyped
|
|
16
|
+
|
|
17
|
+
def paused_at: () -> untyped
|
|
18
|
+
|
|
19
|
+
def resumed_at: () -> untyped
|
|
20
|
+
|
|
21
|
+
def next_enqueue_at: () -> untyped
|
|
22
|
+
|
|
23
|
+
def last_enqueue_at: () -> untyped
|
|
24
|
+
|
|
25
|
+
# Returns the job template for this entry.
|
|
26
|
+
def job: () -> untyped
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Generated from lib/zizq/resources/cron_group.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
module Resources
|
|
5
|
+
# Typed wrapper around a cron group response hash.
|
|
6
|
+
class CronGroup < Resource
|
|
7
|
+
def name: () -> untyped
|
|
8
|
+
|
|
9
|
+
def paused: () -> untyped
|
|
10
|
+
|
|
11
|
+
def paused?: () -> untyped
|
|
12
|
+
|
|
13
|
+
def paused_at: () -> untyped
|
|
14
|
+
|
|
15
|
+
def resumed_at: () -> untyped
|
|
16
|
+
|
|
17
|
+
# Returns the entries in this group as typed resources.
|
|
18
|
+
def entries: () -> untyped
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -4,48 +4,26 @@ module Zizq
|
|
|
4
4
|
module Resources
|
|
5
5
|
# Typed wrapper around a job response hash.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
class Job <
|
|
7
|
+
# Inherits template fields (type, queue, priority, payload, backoff,
|
|
8
|
+
# retention, unique_key, unique_while) from JobTemplate and adds
|
|
9
|
+
# lifecycle fields and action methods.
|
|
10
|
+
class Job < JobTemplate
|
|
11
11
|
def id: () -> untyped
|
|
12
12
|
|
|
13
|
-
def type: () -> untyped
|
|
14
|
-
|
|
15
|
-
def queue: () -> untyped
|
|
16
|
-
|
|
17
|
-
def priority: () -> untyped
|
|
18
|
-
|
|
19
13
|
def status: () -> untyped
|
|
20
14
|
|
|
21
15
|
def ready_at: () -> untyped
|
|
22
16
|
|
|
23
17
|
def attempts: () -> untyped
|
|
24
18
|
|
|
25
|
-
def payload: () -> untyped
|
|
26
|
-
|
|
27
19
|
def dequeued_at: () -> untyped
|
|
28
20
|
|
|
29
21
|
def failed_at: () -> untyped
|
|
30
22
|
|
|
31
23
|
def completed_at: () -> untyped
|
|
32
24
|
|
|
33
|
-
def retry_limit: () -> untyped
|
|
34
|
-
|
|
35
|
-
def unique_key: () -> untyped
|
|
36
|
-
|
|
37
|
-
def unique_while: () -> untyped
|
|
38
|
-
|
|
39
25
|
def duplicate?: () -> untyped
|
|
40
26
|
|
|
41
|
-
# Backoff configuration converted from the wire format (ms) to the
|
|
42
|
-
# Ruby-idiomatic format (seconds), matching the Zizq::backoff type.
|
|
43
|
-
def backoff: () -> untyped
|
|
44
|
-
|
|
45
|
-
# Retention configuration converted from the wire format (ms) to the
|
|
46
|
-
# Ruby-idiomatic format (seconds), matching the Zizq::retention type.
|
|
47
|
-
def retention: () -> untyped
|
|
48
|
-
|
|
49
27
|
# Fetch the error history for this job.
|
|
50
28
|
#
|
|
51
29
|
# @rbs order: Zizq::sort_direction?
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated from lib/zizq/resources/job_template.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Zizq
|
|
4
|
+
module Resources
|
|
5
|
+
# Typed wrapper around a job template — the fields shared between
|
|
6
|
+
# live jobs and cron entry job definitions.
|
|
7
|
+
class JobTemplate < Resource
|
|
8
|
+
def type: () -> untyped
|
|
9
|
+
|
|
10
|
+
def queue: () -> untyped
|
|
11
|
+
|
|
12
|
+
def priority: () -> untyped
|
|
13
|
+
|
|
14
|
+
def payload: () -> untyped
|
|
15
|
+
|
|
16
|
+
def retry_limit: () -> untyped
|
|
17
|
+
|
|
18
|
+
def unique_key: () -> untyped
|
|
19
|
+
|
|
20
|
+
def unique_while: () -> untyped
|
|
21
|
+
|
|
22
|
+
# Backoff configuration converted from the wire format (ms) to the
|
|
23
|
+
# Ruby-idiomatic format (seconds), matching the Zizq::backoff type.
|
|
24
|
+
def backoff: () -> untyped
|
|
25
|
+
|
|
26
|
+
# Retention configuration converted from the wire format (ms) to the
|
|
27
|
+
# Ruby-idiomatic format (seconds), matching the Zizq::retention type.
|
|
28
|
+
def retention: () -> untyped
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/sig/generated/zizq.rbs
CHANGED
|
@@ -58,6 +58,80 @@ module Zizq
|
|
|
58
58
|
# @rbs return: Zizq::Query
|
|
59
59
|
def self.query: () -> Zizq::Query
|
|
60
60
|
|
|
61
|
+
# Return a list of all available Crontab schedules.
|
|
62
|
+
def self.crontabs: () -> untyped
|
|
63
|
+
|
|
64
|
+
# Define (or redefine) a Crontab schedule.
|
|
65
|
+
#
|
|
66
|
+
# This requires a Pro license on the Zizq server.
|
|
67
|
+
#
|
|
68
|
+
# Crontabs are used to define collections of recurring jobs that run on a
|
|
69
|
+
# specified schedule, such as at 2am on every Monday. Each entry on the
|
|
70
|
+
# Crontab is a single job enqueue, which the Zizq server automatically
|
|
71
|
+
# triggers at the correct point in time. Zizq uses standard Cron expression
|
|
72
|
+
# syntax (with support for seconds via 6-fields) to define entries.
|
|
73
|
+
#
|
|
74
|
+
# This is designed to be idempotent. You can define a schedule somewhere in
|
|
75
|
+
# your application startup process (after `Zizq.configure`) and it doesn't
|
|
76
|
+
# matter if multiple process all define the same schedule. Zizq is smart
|
|
77
|
+
# enough to handle this correctly.
|
|
78
|
+
#
|
|
79
|
+
# Entire schedules, and individual entries on a schedule, can be paused and
|
|
80
|
+
# resumed.
|
|
81
|
+
#
|
|
82
|
+
# By default schedules operate in the system time zone of the Zizq server
|
|
83
|
+
# but an explicit IANA timezone name can be specified when defining the
|
|
84
|
+
# Crontab.
|
|
85
|
+
#
|
|
86
|
+
# This method sends exactly *one* request to the Zizq server upon
|
|
87
|
+
# completion of the block. Any existing entries are retained. Any new
|
|
88
|
+
# entries are added, any absent entries are removed, and any modified
|
|
89
|
+
# entries are replaced. In short, whatever the block defines is what the
|
|
90
|
+
# entire resulting Crontab schedule will look like.
|
|
91
|
+
#
|
|
92
|
+
# Zizq.define_crontab("example", timezone: "Europe/Rome") do |cron|
|
|
93
|
+
# cron.define_entry(
|
|
94
|
+
# "refresh_data_warehose",
|
|
95
|
+
# "*/15 * * * *"
|
|
96
|
+
# ).enqueue(RefreshDataWarehoseJob, incremental: true)
|
|
97
|
+
#
|
|
98
|
+
# cron.define_entry(
|
|
99
|
+
# "expire_acess_tokens",
|
|
100
|
+
# "*/10 * * * * *"
|
|
101
|
+
# ).enqueue_raw(
|
|
102
|
+
# queue: "identity-server",
|
|
103
|
+
# type: "expire_access_tokens",
|
|
104
|
+
# priority: 100,
|
|
105
|
+
# payload: {},
|
|
106
|
+
# )
|
|
107
|
+
# end
|
|
108
|
+
#
|
|
109
|
+
# When jobs are pushed to the queue at their execution time, Zizq handles
|
|
110
|
+
# this atomically, so there is no risk of a duplicate enqueue for the same
|
|
111
|
+
# schedule tick. However, if you have long-running jobs that should not be
|
|
112
|
+
# permitted to overlap, such as in the case your schedule runs every 10
|
|
113
|
+
# seconds but jobs can take 30 seconds to execute, you should consider
|
|
114
|
+
# using unique jobs.
|
|
115
|
+
#
|
|
116
|
+
# @rbs name: String
|
|
117
|
+
# @rbs timezone: String?
|
|
118
|
+
# @rbs paused: bool?
|
|
119
|
+
# @rbs &block: (Zizq::CrontabBuilder) -> void
|
|
120
|
+
# @rbs return: Zizq::Crontab
|
|
121
|
+
def self.define_crontab: (String name, ?timezone: String?, ?paused: bool?) { (Zizq::CrontabBuilder) -> void } -> Zizq::Crontab
|
|
122
|
+
|
|
123
|
+
# Obtain a handle for the given Crontab schedule.
|
|
124
|
+
#
|
|
125
|
+
# This is a lazy operation. The schedule data is only fetched from the Zizq
|
|
126
|
+
# server upon first accessing data within the schedule.
|
|
127
|
+
#
|
|
128
|
+
# Zizq.crontab("default").paused?
|
|
129
|
+
# Zizq.crontab("default").resume!
|
|
130
|
+
#
|
|
131
|
+
# @rbs name: String
|
|
132
|
+
# @rbs return: Zizq::Crontab
|
|
133
|
+
def self.crontab: (String name) -> Zizq::Crontab
|
|
134
|
+
|
|
61
135
|
# Enqueue a job by class with positional and keyword arguments.
|
|
62
136
|
#
|
|
63
137
|
# By default all arguments are serialized as JSON, which means hashes with
|
|
@@ -93,12 +167,12 @@ module Zizq
|
|
|
93
167
|
# end
|
|
94
168
|
# end
|
|
95
169
|
#
|
|
96
|
-
# @rbs job_class: Class & Zizq::
|
|
170
|
+
# @rbs job_class: Class & Zizq::JobConfig
|
|
97
171
|
# @rbs args: Array[untyped]
|
|
98
172
|
# @rbs kwargs: Hash[Symbol, untyped]
|
|
99
173
|
# @rbs &block: ?(EnqueueRequest) -> void
|
|
100
174
|
# @rbs return: Resources::Job
|
|
101
|
-
def self.enqueue: (Class & Zizq::
|
|
175
|
+
def self.enqueue: (Class & Zizq::JobConfig job_class, *untyped args, **untyped kwargs) ?{ (EnqueueRequest) -> void } -> Resources::Job
|
|
102
176
|
|
|
103
177
|
# Enqueue a job by providing raw inputs to the Zizq server.
|
|
104
178
|
#
|
|
@@ -171,10 +245,10 @@ module Zizq
|
|
|
171
245
|
# @api private
|
|
172
246
|
# Build an EnqueueRequest for a single job class enqueue.
|
|
173
247
|
#
|
|
174
|
-
# @rbs job_class: Class & Zizq::
|
|
248
|
+
# @rbs job_class: Class & Zizq::JobConfig
|
|
175
249
|
# @rbs args: Array[untyped]
|
|
176
250
|
# @rbs kwargs: Hash[Symbol, untyped]
|
|
177
251
|
# @rbs &block: ?(EnqueueRequest) -> void
|
|
178
252
|
# @rbs return: EnqueueRequest
|
|
179
|
-
def self.build_enqueue_request: (Class & Zizq::
|
|
253
|
+
def self.build_enqueue_request: (Class & Zizq::JobConfig job_class, *untyped args, **untyped kwargs) ?{ (EnqueueRequest) -> void } -> EnqueueRequest
|
|
180
254
|
end
|
data/sig/zizq.rbs
CHANGED
|
@@ -45,6 +45,28 @@ module Zizq
|
|
|
45
45
|
?retention: (retention | singleton(RESET) | singleton(UNCHANGED))?
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
# Job template for cron entry definitions.
|
|
49
|
+
type cron_job_params = {
|
|
50
|
+
type: String,
|
|
51
|
+
queue: String,
|
|
52
|
+
payload: untyped,
|
|
53
|
+
?priority: Integer?,
|
|
54
|
+
?retry_limit: Integer?,
|
|
55
|
+
?backoff: backoff?,
|
|
56
|
+
?retention: retention?,
|
|
57
|
+
?unique_key: String?,
|
|
58
|
+
?unique_while: unique_scope?
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# Parameters for a single cron entry.
|
|
62
|
+
type cron_entry_params = {
|
|
63
|
+
name: String,
|
|
64
|
+
expression: String,
|
|
65
|
+
job: cron_job_params,
|
|
66
|
+
?timezone: String?,
|
|
67
|
+
?paused: bool?
|
|
68
|
+
}
|
|
69
|
+
|
|
48
70
|
# TLS options for connecting over HTTPS. Values are PEM strings or file paths.
|
|
49
71
|
type tls_options = { ?ca: String, ?client_cert: String, ?client_key: String }
|
|
50
72
|
|
|
@@ -58,26 +80,11 @@ module Zizq
|
|
|
58
80
|
|
|
59
81
|
# Structural type for a class that includes Zizq::Job.
|
|
60
82
|
#
|
|
61
|
-
#
|
|
62
|
-
# ClassMethods onto the class. Steep can't infer this from the runtime
|
|
63
|
-
# `extend` call, so we describe the resulting shape as an interface.
|
|
83
|
+
# This serves only to ensure the class can be instantiated without args.
|
|
64
84
|
#
|
|
65
85
|
# The `_` prefix is mandatory RBS syntax for interfaces. The `job_class`
|
|
66
86
|
# type alias below provides a cleaner name for use in source annotations.
|
|
67
87
|
interface _JobClass
|
|
68
|
-
def zizq_queue: (?String?) -> String
|
|
69
|
-
def zizq_retry_limit: (?Integer?) -> Integer?
|
|
70
|
-
def zizq_backoff: (?exponent: Numeric?, ?base: Numeric?, ?jitter: Numeric?) -> backoff?
|
|
71
|
-
def zizq_retention: (?completed: Numeric?, ?dead: Numeric?) -> retention?
|
|
72
|
-
def zizq_unique: (?bool?, ?scope: unique_scope?) -> bool
|
|
73
|
-
def zizq_unique_scope: (?unique_scope?) -> unique_scope?
|
|
74
|
-
def zizq_unique_key: (*untyped, **untyped) -> String
|
|
75
|
-
def zizq_serialize: (*untyped, **untyped) -> Hash[String, untyped]
|
|
76
|
-
def zizq_deserialize: (Hash[String, untyped]) -> [Array[untyped], Hash[Symbol, untyped]]
|
|
77
|
-
def zizq_payload_filter: (*untyped, **untyped) -> String
|
|
78
|
-
def zizq_payload_subset_filter: (*untyped, **untyped) -> String
|
|
79
|
-
def zizq_enqueue_request: (*untyped, **untyped) -> EnqueueRequest
|
|
80
|
-
def name: () -> String?
|
|
81
88
|
def new: () -> Job
|
|
82
89
|
end
|
|
83
90
|
|
|
@@ -91,7 +98,7 @@ module Zizq
|
|
|
91
98
|
# inside an existing bulk block compose naturally.
|
|
92
99
|
interface _EnqueueTarget
|
|
93
100
|
def enqueue: (
|
|
94
|
-
Class &
|
|
101
|
+
Class & JobConfig,
|
|
95
102
|
*untyped,
|
|
96
103
|
**untyped
|
|
97
104
|
) ?{ (EnqueueRequest) -> void } -> untyped
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zizq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Corbyn <chris@zizq.io>
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async-http
|
|
@@ -38,12 +38,11 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '1.7'
|
|
41
|
-
description:
|
|
42
|
-
This is the Ruby client for the Zizq job queue server.
|
|
41
|
+
description: |+
|
|
42
|
+
This is the official Ruby client for the Zizq job queue server.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Zizq is a simple, single binary, zero dependency, language agnostic job queue.
|
|
45
45
|
|
|
46
|
-
This client supports multi-threaded and/or multi-fiber concurrency and is very fast. The Zizq server provides everything needed. There are no separate external storage dependencies to configure.
|
|
47
46
|
email:
|
|
48
47
|
executables:
|
|
49
48
|
- zizq-worker
|
|
@@ -62,6 +61,10 @@ files:
|
|
|
62
61
|
- lib/zizq/bulk_enqueue.rb
|
|
63
62
|
- lib/zizq/client.rb
|
|
64
63
|
- lib/zizq/configuration.rb
|
|
64
|
+
- lib/zizq/crontab.rb
|
|
65
|
+
- lib/zizq/crontab_builder.rb
|
|
66
|
+
- lib/zizq/crontab_entry.rb
|
|
67
|
+
- lib/zizq/crontab_entry_builder.rb
|
|
65
68
|
- lib/zizq/enqueue_request.rb
|
|
66
69
|
- lib/zizq/enqueue_with.rb
|
|
67
70
|
- lib/zizq/error.rb
|
|
@@ -71,11 +74,14 @@ files:
|
|
|
71
74
|
- lib/zizq/middleware.rb
|
|
72
75
|
- lib/zizq/query.rb
|
|
73
76
|
- lib/zizq/resources.rb
|
|
77
|
+
- lib/zizq/resources/cron_entry.rb
|
|
78
|
+
- lib/zizq/resources/cron_group.rb
|
|
74
79
|
- lib/zizq/resources/error_enumerator.rb
|
|
75
80
|
- lib/zizq/resources/error_page.rb
|
|
76
81
|
- lib/zizq/resources/error_record.rb
|
|
77
82
|
- lib/zizq/resources/job.rb
|
|
78
83
|
- lib/zizq/resources/job_page.rb
|
|
84
|
+
- lib/zizq/resources/job_template.rb
|
|
79
85
|
- lib/zizq/resources/page.rb
|
|
80
86
|
- lib/zizq/resources/resource.rb
|
|
81
87
|
- lib/zizq/version.rb
|
|
@@ -87,6 +93,10 @@ files:
|
|
|
87
93
|
- sig/generated/zizq/bulk_enqueue.rbs
|
|
88
94
|
- sig/generated/zizq/client.rbs
|
|
89
95
|
- sig/generated/zizq/configuration.rbs
|
|
96
|
+
- sig/generated/zizq/crontab.rbs
|
|
97
|
+
- sig/generated/zizq/crontab_builder.rbs
|
|
98
|
+
- sig/generated/zizq/crontab_entry.rbs
|
|
99
|
+
- sig/generated/zizq/crontab_entry_builder.rbs
|
|
90
100
|
- sig/generated/zizq/enqueue_request.rbs
|
|
91
101
|
- sig/generated/zizq/enqueue_with.rbs
|
|
92
102
|
- sig/generated/zizq/error.rbs
|
|
@@ -95,11 +105,14 @@ files:
|
|
|
95
105
|
- sig/generated/zizq/lifecycle.rbs
|
|
96
106
|
- sig/generated/zizq/middleware.rbs
|
|
97
107
|
- sig/generated/zizq/query.rbs
|
|
108
|
+
- sig/generated/zizq/resources/cron_entry.rbs
|
|
109
|
+
- sig/generated/zizq/resources/cron_group.rbs
|
|
98
110
|
- sig/generated/zizq/resources/error_enumerator.rbs
|
|
99
111
|
- sig/generated/zizq/resources/error_page.rbs
|
|
100
112
|
- sig/generated/zizq/resources/error_record.rbs
|
|
101
113
|
- sig/generated/zizq/resources/job.rbs
|
|
102
114
|
- sig/generated/zizq/resources/job_page.rbs
|
|
115
|
+
- sig/generated/zizq/resources/job_template.rbs
|
|
103
116
|
- sig/generated/zizq/resources/page.rbs
|
|
104
117
|
- sig/generated/zizq/resources/resource.rbs
|
|
105
118
|
- sig/generated/zizq/version.rbs
|
|
@@ -132,3 +145,4 @@ signing_key:
|
|
|
132
145
|
specification_version: 4
|
|
133
146
|
summary: The official Ruby client for the Zizq job queue
|
|
134
147
|
test_files: []
|
|
148
|
+
...
|