mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-21 00:30:12 -06:00
* fix: gitignore all the generated stuff
* debug: try fixing build
* debug: build error part ii
* debug: move more deps out of dev
* fix: lock
* debug: lockfile
* fix: make dir
* fix: ci
* fix: dir
* debug: sed
* fix: sed
* debug: allow skipping
* Revert "debug: allow skipping"
This reverts commit 88e0ff870d.
* debug: ci
* fix: corepack
* debug: dir
* debug: sed
* debug: path
* fix: rm sync docs for now
* fix: remove more stuff
* fix: rm unused stuff
* fix: rm copy:app
* chore: lint
* fix: rm prettier from boot
* fix: couple missing scripts
* feat: auto-gen examples on push to main
* debug: test on this branch
* fix: install pnpm
* fix: cd
* fix: cmd
* Auto-generate files after merge [skip ci]
* fix: only copy examples
* debug: dummy commit for examples check
* chore: regenerate examples
* fix: naming
* fix: unwind dummy
* fix: only run on main
* fix: pre commit
* fix: naming
* chore: gen, fix task pre
* feat: create pr
* feat: only push examples changes
* fix: don't run from this branch
* fix: regen lockfile
* fix: regen docs lockfile
---------
Co-authored-by: GitHub Action <action@github.com>
40 lines
899 B
Python
40 lines
899 B
Python
import asyncio
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from hatchet_sdk import (
|
|
ConcurrencyExpression,
|
|
ConcurrencyLimitStrategy,
|
|
Context,
|
|
Hatchet,
|
|
)
|
|
|
|
hatchet = Hatchet(debug=True)
|
|
|
|
|
|
class WorkflowInput(BaseModel):
|
|
group: str
|
|
|
|
|
|
concurrency_cancel_in_progress_workflow = hatchet.workflow(
|
|
name="ConcurrencyCancelInProgress",
|
|
concurrency=ConcurrencyExpression(
|
|
expression="input.group",
|
|
max_runs=1,
|
|
limit_strategy=ConcurrencyLimitStrategy.CANCEL_IN_PROGRESS,
|
|
),
|
|
input_validator=WorkflowInput,
|
|
)
|
|
|
|
|
|
@concurrency_cancel_in_progress_workflow.task()
|
|
async def step1(input: WorkflowInput, ctx: Context) -> None:
|
|
for _ in range(50):
|
|
await asyncio.sleep(0.10)
|
|
|
|
|
|
@concurrency_cancel_in_progress_workflow.task(parents=[step1])
|
|
async def step2(input: WorkflowInput, ctx: Context) -> None:
|
|
for _ in range(50):
|
|
await asyncio.sleep(0.10)
|