mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-23 10:39:45 -05:00
feat: v1 engine (#1318)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from hatchet_sdk import Hatchet
|
||||
|
||||
hatchet = Hatchet(debug=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
workflow_list = hatchet.rest.workflow_list()
|
||||
rows = workflow_list.rows or []
|
||||
|
||||
for workflow in rows:
|
||||
print(workflow.name)
|
||||
print(workflow.metadata.id)
|
||||
print(workflow.metadata.created_at)
|
||||
print(workflow.metadata.updated_at)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,20 @@
|
||||
import asyncio
|
||||
|
||||
from hatchet_sdk import Hatchet
|
||||
|
||||
hatchet = Hatchet(debug=True)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
workflow_list = await hatchet.rest.aio_list_workflows()
|
||||
rows = workflow_list.rows or []
|
||||
|
||||
for workflow in rows:
|
||||
print(workflow.name)
|
||||
print(workflow.metadata.id)
|
||||
print(workflow.metadata.created_at)
|
||||
print(workflow.metadata.updated_at)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
@@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
|
||||
from hatchet_sdk import Hatchet, Worker
|
||||
|
||||
|
||||
# requires scope module or higher for shared event loop
|
||||
## IMPORTANT: Worker needs to be set here to ensure at least one workflow exists
|
||||
@pytest.mark.parametrize("worker", ["concurrency_limit_rr"], indirect=True)
|
||||
@pytest.mark.asyncio(scope="session")
|
||||
async def test_list_workflows(hatchet: Hatchet, worker: Worker) -> None:
|
||||
workflows = hatchet.rest.workflow_list()
|
||||
|
||||
assert len(workflows.rows or []) != 0
|
||||
|
||||
|
||||
# requires scope module or higher for shared event loop
|
||||
@pytest.mark.parametrize("worker", ["concurrency_limit_rr"], indirect=True)
|
||||
@pytest.mark.asyncio(scope="session")
|
||||
async def test_async_list_workflows(aiohatchet: Hatchet, worker: Worker) -> None:
|
||||
workflows = await aiohatchet.rest.aio_list_workflows()
|
||||
|
||||
assert len(workflows.rows or []) != 0
|
||||
Reference in New Issue
Block a user