Julio Venegas
12/09/2020, 1:15 PMprefect agent kubernetes start
would start a Kubernetes agent in the environment where Prefect is installed but prefect agent install kubernetes
installs the agent in the Kubernetes cluster right?
Having diagrams for these interactions would make it more intuitive to read the docs.Marc Lipoff
12/09/2020, 2:07 PMs3_client = boto3.client('s3')
with requests.request("GET", url, stream=True) as r:
r.raise_for_status()
for chunk in r:
s3_client.put_object(Body=chunk,
Bucket='xxx',
Key='xxx')
Dotan Asselmann
12/09/2020, 2:09 PMClemens
12/09/2020, 3:01 PM0.13.19.
. As environments are being deprecated I am trying to move the flows over to run_config setup.
I am using the Docker storage and KubernetesRun for run_config. I noticed that the container that is built with KubernetesRun()
is configured with:
command: /bin/sh -c
command arguments: prefect execute flow-run
but when I inject a job spec file with`KubernetesRun(job_template_path="job_specs.yaml")` (as I need to to access the Kubernetes secrets that I need for the flow to run) only the command arguments
are written by the prefect build and the command
is left blank. That leads to the container failing with an "executable not found"
A workaround is to specifically include the command
section in the job specs file command: ["/bin/sh", "-c"]
.
That doesn’t seem to be expected behaviour, or am I missing something?Avi A
12/09/2020, 3:02 PMAmit Gal
12/09/2020, 3:53 PMmap
case
.
More in detail, I am converting into Prefect an existing process currently run locally through a simple CLI, to fetch and handle datasets from a remote server. One of the first things in this process is checking the dataset version, using check_version(id)
which returns a bool
. In the CLI this is then used in a simple logical block to determine how to continue. In the CLI a list of ids is handed and looped over, making that check for each element in the list (sequentially).
I want to convert this into Prefect and take advantage of the parallelisation opportunities. Therefore, I thought that case
and map
would work great here, something like this (which is not possible):
ids = [id1, id2, id3]
with Flow('Check version') as flow:
with case (check_version.map(id=ids), True):
val1 = action_if_true()
with case (check_version.map(id=ids), False):
val2 = action_if_false()
The issue here being that the output from check_version(id)
is mapped, and is therefore a list of bools - [True, True, False]
, which cannot be compared against a bool
. I found no option to map `case`.
I did however see the option to map `switch`, and I could imagine using that if I have to, but since it must take strings as input (it uses a dict
to get the different scenarios) it would require a conversion or changing the original functions in the CLI, which I would rather not do.
This is a pretty simple thing, and I imagine someone else has solved this before, but could not locate anything in the docs or other places. Or perhaps I am thinking about this in the wrong way. Any input is welcome, thanks!SImon Hawe
12/09/2020, 3:59 PMMitchell Bregman
12/09/2020, 4:59 PMpyodbc
to be installed in order to connect to a SQLServer instance… i have pulled Prefects master
docker image and ran interactively to test out `pip install pyodbc`… running into gcc issues, as expected, but i am now trying to apt-get
or apt install
an odbc driver unixodbc-dev
and getting weird “not found” type results… i have run into similar issues, but was relying on a conda environment which allowed me to conda install pyodbc
but how can i replicate this here with pip
?Arthur Duarte
12/09/2020, 6:10 PMprefect create project "my-project"
Can we also delete projects, using a similar command ?Sébastien
12/09/2020, 9:36 PM#> prefect auth login -t "<my token>"
Error attempting to communicate with Prefect Cloud
I can confirm that ~/.prefect/config.toml
isn't being created.
Trying to use python3 start.py
to register any flow gives:
prefect.utilities.exceptions.ClientError: Malformed response received from Cloud - please ensure that you have an API token properly configured.
which unfortunately doesn't add any info.
Pinging <http://api.prefect.io|api.prefect.io>
works:
PING <http://api.prefect.io|api.prefect.io> (34.96.72.220) 56(84) bytes of data.
64 bytes from <http://220.72.96.34.bc.googleusercontent.com|220.72.96.34.bc.googleusercontent.com> (34.96.72.220): icmp_seq=1 ttl=116 time=3.71 ms
Any ideas?Sébastien
12/10/2020, 12:53 AMJoseph
12/10/2020, 2:18 AMDotan Asselmann
12/10/2020, 7:37 AMEdison A
12/10/2020, 9:03 AMAlex Koay
12/10/2020, 9:16 AMDali
12/10/2020, 11:29 AMDotan Asselmann
12/10/2020, 12:56 PMMarc Lipoff
12/10/2020, 2:57 PMflow.visualize()
? I installed the viz package with pip install prefect[viz]
but am still getting this:
Traceback (most recent call last):
File "insurance_export.py", line 184, in <module>
flow.visualize()
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/site-packages/prefect/core/flow.py", line 1406, in visualize
graph.render(tmp.name, view=True)
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/site-packages/graphviz/files.py", line 216, in render
self._view(rendered, self._format, quiet_view)
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/site-packages/graphviz/files.py", line 262, in _view
view_method(filepath, quiet)
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/site-packages/graphviz/backend.py", line 323, in view_unixoid
popen_func(cmd)
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/ec2-user/anaconda3/envs/python38_prefect/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'xdg-open'
Hamed Sheykhlou
12/10/2020, 3:20 PMZach
12/10/2020, 5:50 PMrun_config
for my flow like this:
with Flow("dask_flow_test", run_config=KubernetesRun()) as flow:
Then if I run it locally, will it create a kubernetes job?
If I don't want it to create a kuberentes job when I run it locally, should I instead set the run_config
to LocalRun
there, and then before I register the flow I can set it to KubernetesRun
instead?liren zhang
12/10/2020, 6:01 PMimport prefect
import prefect.utilities.context
from prefect.environments.storage import Local
from prefect.engine.results import LocalResult
from prefect import task, Flow
with prefect.context(a=1, b=2):
print(prefect.context.a) # 1
@task(name='task_today')
def report_start_day():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(prefect.context.today)
<http://logger.info|logger.info>(prefect.context.flow_run_id)
with Flow('My flow', storage=Local(), result=LocalResult()) as flow:
report_start_day()
flow.register(project_name="prefect_first_project")
liren zhang
12/10/2020, 6:01 PMliren zhang
12/10/2020, 6:02 PMliren zhang
12/10/2020, 6:03 PMChristian
12/10/2020, 7:05 PMrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: <http+docker://localhost/v1.40/images/create?tag=0.13.19-python3.9&fromImage=prefecthq%2Fprefect>
more trace ...
File "/Users/werner-ch/.pyenv/versions/3.9.0/envs/dataflow/lib/python3.9/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.NotFound: 404 Client Error for <http+docker://localhost/v1.40/images/create?tag=0.13.19-python3.9&fromImage=prefecthq%2Fprefect>: Not Found ("manifest for prefecthq/prefect:0.13.19-python3.9 not found: manifest unknown: manifest unknown")
Would anyone know where I should start digging?
My base image is: https://hub.docker.com/r/cwerner/dataflowShawn Marhanka
12/10/2020, 7:40 PMUnexpected error: ClientError([{'path': ['create_flow_run'], 'message': '[{\'extensions\': {\'path\': \'$.variableValues.insert_objects[0].idempotency_key\', \'code\': \'validation-failed\'}, \'message\': \'field "idempotency_key" not found in type: \\\'flow_run_insert_input\\\'\'}]', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
We got the error on 13.16 then reverted back to 13.13 and are still getting the error.Sean Talia
12/10/2020, 7:40 PMTraceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/prefect/engine/runner.py", line 48, in inner
new_state = method(self, state, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 856, in get_task_run_state
value = prefect.utilities.executors.run_task_with_timeout(
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/executors.py", line 298, in run_task_with_timeout
return task.run(*args, **kwargs) # type: ignore
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/tasks.py", line 449, in method
return run_method(self, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/tasks/prefect/flow_run.py", line 160, in run
flow_run_id = client.create_flow_run(
File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 1041, in create_flow_run
res = self.graphql(create_mutation, variables=dict(input=inputs))
File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 318, in graphql
raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'path': ['create_flow_run'], 'message': '[{\'extensions\': {\'path\': \'$.variableValues.insert_objects[0].idempotency_key\', \'code\': \'validation-failed\'}, \'message\': \'field "idempotency_key" not found in type: \\\'flow_run_insert_input\\\'\'}]', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]
all my containers are running prefect 0.13.18 on python 3.8Sean Talia
12/10/2020, 7:42 PMKevin Weiler
12/10/2020, 8:13 PMPREFECT__LOGGING__EXTRA_LOGGERS
environment variable both when launching my agent and injecting that variable into my docker container at runtime (with the -env
arg). Any advice on how to proceed?Pedro Machado
12/11/2020, 12:28 AMrestricted
and unrestricted
• The restricted
label in Prefect Cloud has a concurrency limit of 1
• The unrestricted
label does not have any concurrency limits
• Some flows have the restricted
label and the rest have the unrestricted
label
• The idea is to be able to run at most one restricted
flow at a time and allow the unrestricted
flows to use all available slots (we have 2 slots at the moment)
The concurrency limit is working. Only one restricted
flow runs at a time. The problem is that unrestricted
flows don't start while there is a restricted
flow running.
Any ideas? Could you help troubleshoot?
edit: if we start the unrestricted
flow first and the restricted
flow second both run, but if the restricted
flow starts first the other doesn't runPedro Machado
12/11/2020, 12:28 AMrestricted
and unrestricted
• The restricted
label in Prefect Cloud has a concurrency limit of 1
• The unrestricted
label does not have any concurrency limits
• Some flows have the restricted
label and the rest have the unrestricted
label
• The idea is to be able to run at most one restricted
flow at a time and allow the unrestricted
flows to use all available slots (we have 2 slots at the moment)
The concurrency limit is working. Only one restricted
flow runs at a time. The problem is that unrestricted
flows don't start while there is a restricted
flow running.
Any ideas? Could you help troubleshoot?
edit: if we start the unrestricted
flow first and the restricted
flow second both run, but if the restricted
flow starts first the other doesn't runChris White
12/11/2020, 12:41 AMrestricted
label and one with the unrestricted
label and let me know if the behavior is any different?Pedro Machado
12/11/2020, 3:50 AMChris White
12/11/2020, 3:51 AM