Comments (3)
I understood, that this streaming syntax is actually the way to do:
from hatchet_sdk import StepRunEventType
event:StepRunEventType
for event in self._hatchet.client.listener.stream(self._messageID):
print(event.payload)
The problem is, that if the event does not seem to be caught if the run has already been finished before the for loop starts executing.
How do I check if the run has already been computed and get its payload? The payload is there, because it is accessible via the Web UI.
from hatchet.
One would hope to have the following code do the trick:
from hatchet_sdk import WorkflowRun
workflow_run:WorkflowRun = self._hatchet.client.rest_client.workflow_run_get(self._messageID)
print(workflow_run.status)
Except, that it does not. The workflow_run_get
errors with
Traceback (most recent call last):
File "/snap/pycharm-professional/384/plugins/python/helpers-pro/pydevd_asyncio/pydevd_asyncio_utils.py", line 117, in _exec_async_code
result = func()
^^^^^^
File "<input>", line 1, in <module>
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/hatchet_sdk/clients/rest_client.py", line 58, in workflow_run_get
return self.workflow_api.workflow_run_get(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/pydantic/validate_call_decorator.py", line 58, in wrapper_function
return validate_call_wrapper(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py", line 81, in __call__
res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/hatchet_sdk/clients/rest/api/workflow_api.py", line 1476, in workflow_run_get
response_data = self.api_client.call_api(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/hatchet_sdk/clients/rest/api_client.py", line 269, in call_api
response_data = self.rest_client.request(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/hatchet_sdk/clients/rest/rest.py", line 243, in request
r = self.pool_manager.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/urllib3/_request_methods.py", line 136, in request
return self.request_encode_url(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/urllib3/_request_methods.py", line 183, in request_encode_url
return self.urlopen(method, url, **extra_kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/urllib3/poolmanager.py", line 433, in urlopen
conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adam/.cache/pypoetry/virtualenvs/stan-runner-1qcHgIo7-py3.12/lib/python3.12/site-packages/urllib3/poolmanager.py", line 295, in connection_from_host
raise LocationValueError("No host specified.")
urllib3.exceptions.LocationValueError: No host specified.
Upon inspection, the url of the underlying REST api call indeed lacks the hostname. It consists purely of the path, such as /api/v1/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/workflow-runs/e5e3eadd-e91f-43af-a399-67c54d1aeb31
.
from hatchet.
Hey @adamryczkowski, the empty hostname likely means that you haven't set the HATCHET_CLIENT_TOKEN
environment variable. And could you share the version of the Python SDK you're using? I believe we patched the py SDK recently to fix the rest_client
.
from hatchet.
Related Issues (20)
- existing crons are not cancelled when redeploying with a new workflow version
- [feature request] oidc keycloak
- [feature request] typescript when has Scheduling Workflows and Child Workflows
- feat: cron and schedule metadata
- feat: python metadata support
- feat: go metadata support
- docs: update metadata docs
- SSL error: Failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:7 HOT 1
- feat: support linux/arm64/v8 platform
- bug: crons with concurrency limits set cause the engine to crash HOT 3
- `ctx.SpawnWorkflow()` ignores HATCHET_CLIENT_NAMESPACE
- feat(py): refresh timeout support HOT 1
- Go demo example doesn't work or is not updated. HOT 2
- how to create dynamic steps HOT 1
- Find a workflow run by original input field HOT 2
- docs: fix go sdk quickstart
- docs: Kubernetes Quickstart script only works as root user
- docs: Kubernetes Quickstart examples are incomplete
- bug: after restarting the engine, the same step gets executed twice, leading to unexpected behavior HOT 2
- bug: go sdk needs prefixed step/action names
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hatchet.