mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-01 06:11:02 -06:00
* fix: job cancellations with shared ctx * fix: found the bug * fix: all job runs were getting cancelled * feat: support logging from executions * fix: place logging in background * add back split screen
25 lines
547 B
Python
25 lines
547 B
Python
import time
|
|
from hatchet_sdk import Hatchet, Context
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
hatchet = Hatchet()
|
|
|
|
@hatchet.workflow(on_events=["user:create"],schedule_timeout="10m")
|
|
class LoggingWorkflow:
|
|
@hatchet.step()
|
|
def logger(self, context : Context):
|
|
|
|
for i in range(1000):
|
|
context.log(f"Logging message {i}")
|
|
|
|
return {
|
|
"step1": "completed",
|
|
}
|
|
|
|
workflow = LoggingWorkflow()
|
|
worker = hatchet.worker('logging-worker-py')
|
|
worker.register_workflow(workflow)
|
|
|
|
worker.start() |