mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 00:40:10 -06:00
feat: logging from step run executions (#217)
* 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
This commit is contained in:
25
python-sdk/examples/logger/worker.py
Normal file
25
python-sdk/examples/logger/worker.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user