feat: workflow visualization and qol improvements (#140)

* feat: workflow visualization and qol improvements

* fix: npm build
This commit is contained in:
abelanger5
2024-02-01 22:35:05 -08:00
committed by GitHub
parent ab9f8e6c47
commit aed11c3958
38 changed files with 1673 additions and 302 deletions
+6 -7
View File
@@ -6,10 +6,10 @@ stepsType = List[Tuple[str, Callable[..., Any]]]
class WorkflowMeta(type):
def __new__(cls, name, bases, attrs):
serviceName = "default"
serviceName = name.lower()
concurrencyActions: stepsType = [(name.lower() + "-" + func_name, attrs.pop(func_name)) for func_name, func in list(attrs.items()) if hasattr(func, '_concurrency_fn_name')]
steps: stepsType = [(name.lower() + "-" + func_name, attrs.pop(func_name)) for func_name, func in list(attrs.items()) if hasattr(func, '_step_name')]
concurrencyActions: stepsType = [(func_name, attrs.pop(func_name)) for func_name, func in list(attrs.items()) if hasattr(func, '_concurrency_fn_name')]
steps: stepsType = [(func_name, attrs.pop(func_name)) for func_name, func in list(attrs.items()) if hasattr(func, '_step_name')]
# Define __init__ and get_step_order methods
original_init = attrs.get('__init__') # Get the original __init__ if it exists
@@ -45,22 +45,21 @@ class WorkflowMeta(type):
createStepOpts: List[CreateWorkflowStepOpts] = [
CreateWorkflowStepOpts(
readable_id=func_name,
action="default:" + func_name,
action=serviceName + ":" + func_name,
timeout=func._step_timeout or "60s",
inputs='{}',
parents=[x for x in func._step_parents] # Assuming this is how you get the parents
parents=[x for x in func._step_parents]
)
for func_name, func in attrs.items() if hasattr(func, '_step_name')
]
concurrency : WorkflowConcurrencyOpts | None = None
if len(concurrencyActions) > 0:
action = concurrencyActions[0]
concurrency = WorkflowConcurrencyOpts(
action="default:" + action[0],
action=serviceName + ":" + action[0],
max_runs=action[1]._concurrency_max_runs,
)
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hatchet-sdk"
version = "0.7.1"
version = "0.8.0"
description = ""
authors = ["Alexander Belanger <alexander@hatchet.run>"]
readme = "README.md"