Rob Fowler
06/02/2023, 5:10 AMRob Fowler
06/02/2023, 5:46 AMJoshua Greenhalgh
06/02/2023, 12:41 PMDavid Michael Carter
06/02/2023, 1:02 PM# callable name generator for mapped task
def generate_task_run_name_foo(dataset: dict, **kwargs):
return 'Foo: ' + dataset['name']
# task that gets mapped in the flow
@task(... , task_run_name=generate_task_run_name_foo)
def foo(dataset: dict, ...):
...
Prefect 2 doesn’t seem to pass the args of foo into the name generator like v1 does.
Is there a different way of achieving this in v2?
Prefect 2 transcription leads to missing 1 required positional argument: 'dataset'
Romain Vincent
06/02/2023, 2:19 PM--api http://<remote-ip>:4200
or --api <http://localhost:4200>
or --api <http://127.0.0.1:4200>
or --api <http://0.0.0.0:4200>
; the result is the same. If I spin the agent locally while specifying the remote api url, I get the agent to pick up the runs though. Does that mean that, for some reason, it is not possible to run an agent on the same machine as the Prefect server? Is there something I'm missing here.Ajinkya P
06/02/2023, 5:55 PMYaron Levi
06/03/2023, 11:11 AMAditya N
06/03/2023, 1:33 PMMussie
06/04/2023, 9:12 AMJoshua Greenhalgh
06/04/2023, 2:16 PMkasteph
06/05/2023, 12:12 PMJozo
06/05/2023, 12:42 PMrun_deployment
?Gregory Hunt
06/05/2023, 1:05 PMasyncio.exceptions.TimeoutError
04:20:16.970 | WARNING | prefect.server.services.marklateruns - MarkLateRuns took 5.009215 seconds to run, which is longer than its loop interval of 5.0 seconds.
04:20:17.195 | ERROR | prefect.server.services.failexpiredpauses - Unexpected error in: TimeoutError()
Traceback (most recent call last):
asyncio.exceptions.TimeoutError
07:48:18.910 | WARNING | prefect.server.services.flowrunnotifications - FlowRunNotifications took 5.011953 seconds to run, which is longer than its loop interval of 4 seconds.
07:48:18.917 | ERROR | prefect.server.services.recentdeploymentsscheduler - Unexpected error in: TimeoutError()
Andreas Nord
06/05/2023, 1:41 PM@flow
def test_flow():
for i in range(20):
task_res = test_task.submit(i)
if all_test_task_succeeded:
final_task()
Eric
06/05/2023, 1:41 PMKirill Ulich
06/05/2023, 2:15 PMAndres Vivallo Speer
06/05/2023, 2:18 PM.submit()
method), the task executes a deployment using the run_deployment()
method, then the deployment creates a flow_run
. I need to obtain the final status of the execution of the flow_run
and that the final status of the task that executes the deployment is the same final status of the execution of the flow_run (subflow). Currently, my task that executes the deployment remains COMPLETED
regardless of the final state of the execution of the flow_run that was triggered by the deployment.
from prefect.deployments import run_deployment
run_deploy = run_deployment_task.with_options(name=<NAME>).submit(
deployment_name=,
environment=environment)
run_deploy.wait()
Farhood Etaati
06/05/2023, 2:32 PMFarhood Etaati
06/05/2023, 2:33 PMFarhood Etaati
06/05/2023, 2:33 PMRaffaele Scarano
06/05/2023, 3:23 PMFROM prefecthq/prefect:2-python3.10-conda
(I need a conda env to install all the deps my code need).
My Dockerfile is:
FROM prefecthq/prefect:2-python3.10-conda
COPY environment.yml .
COPY requirements.txt .
COPY setup.cfg .
COPY setup.py .
COPY my-logic .
RUN apt-get update && apt-get install -y libarchive13
RUN conda install -c conda-forge mamba
RUN mamba env update --prefix /opt/conda/envs/prefect -f environment.yml
RUN pip install --upgrade pip setuptools --no-cache-dir
RUN pip install --trusted-host <http://pypi.python.org|pypi.python.org> --no-cache-dir .
ARG PREFECT_API_KEY
ENV PREFECT_API_KEY=$PREFECT_API_KEY
ARG PREFECT_API_URL
ENV PREFECT_API_URL=$PREFECT_API_URL
ENV PYTHONUNBUFFERED True
COPY flows/ /opt/prefect/flows/
ENTRYPOINT ["/bin/bash", "--login", "-c", "prefect agent start -q default"]
The action build goes well, but when i run the deploy from prefect cloud, the VM on GCP creates the job in CloudRun but it returns /opt/conda/bin/python: Error while finding module specification for 'prefect.engine' (ModuleNotFoundError: No module named 'prefect')
What I'm doing wrong?
I still do not understand if I have to change also the action/deploy-flows/action.yml
to make it create a conda env; in any case I tried both and nothing changed.
The modified action.yml is
runs:
using: "composite"
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
shell: bash
python-version: "${{ inputs.python_version }}"
cache: 'pip'
- id: install-myenv
run: |
conda install -c conda-forge mamba
mamba env update --file environment.yml
${{ inputs.install_command }}
shell: bash
- id: login-prefect
run: |
prefect config set PREFECT_API_KEY=${{ inputs.prefect_api_key }}
prefect config set PREFECT_API_URL=${{ inputs.prefect_api_url }}
shell: bash
If i switch my dockerfile back to a non conda image (FROM prefecthq/prefect:2-python3.10
), everything goes fine, but my deps are not fully covered.Robert Esteves
06/05/2023, 3:43 PMMitch
06/05/2023, 4:05 PMDominic Tarro
06/05/2023, 4:14 PMEXTRA_PIP_PACKAGES="package-a package-b"
.
My current strategy is submodule the internal dependency and install as editable, but that depends if this variable just being passed to pip as the arguments like pip install $EXTRA_PIP_PACKAGES
? Then I could set it like EXTRA_PIP_PACKAGES="package-a package-b -e ./package-c"
.
Anybody have insight here?ketan
06/05/2023, 5:00 PMTomas Moreno
06/05/2023, 5:00 PMAaron Wormus
06/05/2023, 8:28 PMDavid Beck
06/05/2023, 9:33 PMprefect-snowflake
, however I received this error message indicating one of the subpackages is missing something:
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_OPENSSL_CLEANUP'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/deploy.py", line 80, in <module>
flow = load_flow_from_script(path=f"{working_dir}/{config['flow_path']}", flow_name=config['flow_name'].replace('_', '-'))
File "/usr/local/lib/python3.8/site-packages/prefect/flows.py", line 794, in load_flow_from_script
load_flows_from_script(path),
File "/usr/local/lib/python3.8/site-packages/prefect/flows.py", line 770, in load_flows_from_script
return registry_from_script(path).get_instances(Flow)
File "/usr/local/lib/python3.8/site-packages/prefect/context.py", line 449, in registry_from_script
load_script_as_module(path)
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at '/github/workspace/etl_trigger/trigger_candidate.py' encountered an exception: AttributeError("cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_OPENSSL_CLEANUP'")
Is anyone else seeing this issue?Matt Alhonte
06/06/2023, 12:38 AM