mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-07 01:09:38 -06:00
chore: qol improvements (#137)
This commit is contained in:
@@ -21,13 +21,14 @@ class Hatchet:
|
||||
|
||||
return inner
|
||||
|
||||
def workflow(self, name : str='', on_events : list=[], on_crons : list=[], version : str=''):
|
||||
def workflow(self, name : str='', on_events : list=[], on_crons : list=[], version : str='', timeout : str = '60m'):
|
||||
def inner(cls):
|
||||
cls.on_events = on_events
|
||||
cls.on_crons = on_crons
|
||||
cls.name = name or str(cls.__name__)
|
||||
cls.client = self.client
|
||||
cls.version = version
|
||||
cls.timeout = timeout
|
||||
|
||||
# Define a new class with the same name and bases as the original, but with WorkflowMeta as its metaclass
|
||||
return WorkflowMeta(cls.__name__, cls.__bases__, dict(cls.__dict__))
|
||||
|
||||
@@ -339,7 +339,7 @@ class Worker:
|
||||
if action.action_type == ActionType.START_STEP_RUN:
|
||||
self.handle_start_step_run(action)
|
||||
elif action.action_type == ActionType.CANCEL_STEP_RUN:
|
||||
self.thread_pool.submit(self.handle_cancel_step_run, action)
|
||||
self.thread_pool.submit(self.handle_cancel_action, action.step_run_id)
|
||||
elif action.action_type == ActionType.START_GET_GROUP_KEY:
|
||||
self.handle_start_group_key_run(action)
|
||||
else:
|
||||
|
||||
@@ -40,6 +40,7 @@ class WorkflowMeta(type):
|
||||
event_triggers = attrs['on_events']
|
||||
cron_triggers = attrs['on_crons']
|
||||
version = attrs['version']
|
||||
workflowTimeout = attrs['timeout']
|
||||
|
||||
createStepOpts: List[CreateWorkflowStepOpts] = [
|
||||
CreateWorkflowStepOpts(
|
||||
@@ -70,8 +71,8 @@ class WorkflowMeta(type):
|
||||
cron_triggers=cron_triggers,
|
||||
jobs=[
|
||||
CreateWorkflowJobOpts(
|
||||
name="my-job",
|
||||
timeout="60s",
|
||||
name=name,
|
||||
timeout=workflowTimeout,
|
||||
steps=createStepOpts,
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "hatchet-sdk"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
description = ""
|
||||
authors = ["Alexander Belanger <alexander@hatchet.run>"]
|
||||
readme = "README.md"
|
||||
|
||||
Reference in New Issue
Block a user