hatchet-sdk 0.8.1 → 0.9.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/CHANGELOG.md +6 -0
- data/lib/hatchet/features/workflows.rb +45 -0
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet/workflow.rb +23 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf12b2683a7b26125e459a66b28acfa0d0c04cc5a4b148cadcce6a29f69b53ea
|
|
4
|
+
data.tar.gz: ea2fc0114f0a8d236d899b1713c85e5383bf83ab19cc0099020d680f35501db0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd9e284829bb0ede7127685699cd79e0c5283d693aee9bc5e6e201cd2518e20c08e83e884054a3325bda3c0435e5743ff35137f6ebb44cbeea9383b83617250b
|
|
7
|
+
data.tar.gz: 7ac930e2413632481a339e892cbc932fc205d15c6012a2f9e4ea43fe002282c40a24a6f47d555c1fd222c285ee16a2c5155595a2405c89fd3c975ce86e77a32c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to Hatchet's Ruby SDK will be documented in this changelog.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.9.0] - 2026-09-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `pause` and `unpause` methods to the workflows client (`hatchet.workflows.pause(workflow_id, queue_ttl:)`) and to workflows (`workflow.pause(queue_ttl:)`). `queue_ttl` is how long runs stay queued while the workflow is paused, in seconds or as a duration string, and the behavior (`QUEUE` or `DROP`) for cron and scheduled runs triggered while paused can optionally be set, both defaulting to `QUEUE`.
|
|
13
|
+
|
|
8
14
|
## [0.8.1] - 2026-10-05
|
|
9
15
|
|
|
10
16
|
### Fixed
|
|
@@ -82,6 +82,51 @@ module Hatchet
|
|
|
82
82
|
def delete(workflow_id)
|
|
83
83
|
@workflow_api.workflow_delete(workflow_id)
|
|
84
84
|
end
|
|
85
|
+
|
|
86
|
+
# Pause a workflow. While paused, new runs of the workflow are queued but not started.
|
|
87
|
+
#
|
|
88
|
+
# @param workflow_id [String] The ID of the workflow to pause
|
|
89
|
+
# @param queue_ttl [Integer, String] How long runs stay queued while the workflow is paused before they are dropped, in seconds or as a duration string (e.g. "1h30m")
|
|
90
|
+
# @param paused_workflow_cron_run_queue_behavior [String] The behavior of cron runs triggered while the workflow is paused ("QUEUE" or "DROP")
|
|
91
|
+
# @param paused_workflow_scheduled_run_queue_behavior [String] The behavior of scheduled runs triggered while the workflow is paused ("QUEUE" or "DROP")
|
|
92
|
+
# @return [HatchetSdkRest::Workflow] The updated workflow
|
|
93
|
+
# @raise [HatchetSdkRest::ApiError] If the API request fails
|
|
94
|
+
# @example
|
|
95
|
+
# hatchet.workflows.pause("workflow-123", queue_ttl: 3600)
|
|
96
|
+
def pause(
|
|
97
|
+
workflow_id,
|
|
98
|
+
queue_ttl:,
|
|
99
|
+
paused_workflow_cron_run_queue_behavior: HatchetSdkRest::WorkflowPauseScheduledCronRunQueueBehavior::QUEUE,
|
|
100
|
+
paused_workflow_scheduled_run_queue_behavior: HatchetSdkRest::WorkflowPauseScheduledCronRunQueueBehavior::QUEUE
|
|
101
|
+
)
|
|
102
|
+
pause_request = HatchetSdkRest::PauseWorkflowRequestPause.new(
|
|
103
|
+
action: "pause",
|
|
104
|
+
paused_workflow_queue_ttl: queue_ttl.is_a?(String) ? queue_ttl : "#{queue_ttl}s",
|
|
105
|
+
paused_workflow_cron_run_queue_behavior: paused_workflow_cron_run_queue_behavior,
|
|
106
|
+
paused_workflow_scheduled_run_queue_behavior: paused_workflow_scheduled_run_queue_behavior,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
@workflow_api.workflow_update(
|
|
110
|
+
workflow_id,
|
|
111
|
+
HatchetSdkRest::WorkflowUpdateRequest.new(pause: pause_request),
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Unpause a workflow
|
|
116
|
+
#
|
|
117
|
+
# @param workflow_id [String] The ID of the workflow to unpause
|
|
118
|
+
# @return [HatchetSdkRest::Workflow] The updated workflow
|
|
119
|
+
# @raise [HatchetSdkRest::ApiError] If the API request fails
|
|
120
|
+
# @example
|
|
121
|
+
# hatchet.workflows.unpause("workflow-123")
|
|
122
|
+
def unpause(workflow_id)
|
|
123
|
+
@workflow_api.workflow_update(
|
|
124
|
+
workflow_id,
|
|
125
|
+
HatchetSdkRest::WorkflowUpdateRequest.new(
|
|
126
|
+
pause: HatchetSdkRest::PauseWorkflowRequestUnpause.new(action: "unpause"),
|
|
127
|
+
),
|
|
128
|
+
)
|
|
129
|
+
end
|
|
85
130
|
end
|
|
86
131
|
end
|
|
87
132
|
end
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet/workflow.rb
CHANGED
|
@@ -348,6 +348,29 @@ module Hatchet
|
|
|
348
348
|
)
|
|
349
349
|
end
|
|
350
350
|
|
|
351
|
+
# Pause this workflow. While paused, new runs of the workflow are queued but not started.
|
|
352
|
+
#
|
|
353
|
+
# @param queue_ttl [Integer, String] How long runs stay queued while the workflow is paused before they are dropped, in seconds or as a duration string (e.g. "1h30m")
|
|
354
|
+
# @param paused_workflow_cron_run_queue_behavior [String] The behavior of cron runs triggered while the workflow is paused ("QUEUE" or "DROP")
|
|
355
|
+
# @param paused_workflow_scheduled_run_queue_behavior [String] The behavior of scheduled runs triggered while the workflow is paused ("QUEUE" or "DROP")
|
|
356
|
+
# @return [HatchetSdkRest::Workflow] The updated workflow
|
|
357
|
+
# @raise [Hatchet::Error] If no client is associated with the workflow
|
|
358
|
+
def pause(queue_ttl:, **opts)
|
|
359
|
+
raise Error, "No client associated with workflow #{@name}" unless @client
|
|
360
|
+
|
|
361
|
+
@client.workflows.pause(id, queue_ttl: queue_ttl, **opts)
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
# Unpause this workflow.
|
|
365
|
+
#
|
|
366
|
+
# @return [HatchetSdkRest::Workflow] The updated workflow
|
|
367
|
+
# @raise [Hatchet::Error] If no client is associated with the workflow
|
|
368
|
+
def unpause
|
|
369
|
+
raise Error, "No client associated with workflow #{@name}" unless @client
|
|
370
|
+
|
|
371
|
+
@client.workflows.unpause(id)
|
|
372
|
+
end
|
|
373
|
+
|
|
351
374
|
private
|
|
352
375
|
|
|
353
376
|
# Resolve the workflow UUID by looking up the workflow by name via the REST API.
|