chore: qol improvements (#137)

This commit is contained in:
abelanger5
2024-01-29 21:08:52 -08:00
committed by GitHub
parent d63b66a837
commit 52ba01bf06
6 changed files with 27 additions and 10 deletions

View File

@@ -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__))

View File

@@ -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:

View File

@@ -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,
)
],

View File

@@ -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"