https://prefect.io logo
Join the conversationJoin Slack
Channels
announcements
ask-marvin
best-practices-coordination-plane
data-ecosystem
data-tricks-and-tips
events
find-a-prefect-job
geo-australia
geo-bay-area
geo-berlin
geo-boston
geo-chicago
geo-colorado
geo-dc
geo-israel
geo-japan
geo-london
geo-nyc
geo-seattle
geo-texas
gratitude
introductions
marvin-in-the-wild
prefect-ai
prefect-aws
prefect-azure
prefect-cloud
prefect-community
prefect-contributors
prefect-dbt
prefect-docker
prefect-gcp
prefect-getting-started
prefect-integrations
prefect-kubernetes
prefect-recipes
prefect-server
prefect-ui
random
show-us-what-you-got
Powered by Linen
prefect-community
  • j

    Julio Venegas

    12/09/2020, 1:15 PM
    Hi Prefect team, I’ve been reading a bit more on agents and I think that having diagrams in the documentation for the interactions between different agent types, the Prefect API (is this GraphQL??), and the storage and executor chosen for a Flow, would really help making it crystal clear what happens where. For example, the docs on a local agent make it very clear that it is local because the Flows that the local agent polls the Prefect API for, will be run in the same machine as where Prefect has been installed. So the logal agent is both local in the sense that it is 1) a process local to the machine where Prefect is installed, and 2) runs Flows in the same machine as where Prefect is installed. But when I read the Kubernetes agent docs, it is not clear to me whether the Kubernetes agent process runs in the same environment/machine as where Prefect is installed and pushes Flows to a Kubernetes cluster, or whether we install a Kubernetes agent in our Kubernetes cluster and it pulls Flows to the cluster. Or are both valid options?
    prefect 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.
    j
    • 2
    • 2
  • m

    Marc Lipoff

    12/09/2020, 2:07 PM
    Hi everyone. Does any one have experience/examples of getting a large response from a http get call, and writing to s3? Prefect has the map functionality, which seems like a good way to do this. If I were not using prefect, I'd do something like this:
    s3_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')
    s
    • 2
    • 3
  • d

    Dotan Asselmann

    12/09/2020, 2:09 PM
    Hi Prefect team, i’m new to prefect[the project looks amazing! and exactly what I was looking for] I have one basic question - is that possible to run locally my flow [much like flow.run()] without any agent including local agent, BUT - still send the results and logs to the server? I know I can use the client object to submit a flow run and catch it with a local agent but i want to skip this step
    s
    s
    • 3
    • 4
  • c

    Clemens

    12/09/2020, 3:01 PM
    Hi Prefect Team, We have a prefect-server running on a Kubernetes cluster and just updated to
    0.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?
    j
    m
    • 3
    • 5
  • a

    Avi A

    12/09/2020, 3:02 PM
    Hey community, We have a mapped task in our flow, spawning several thousand mapped tasks, whose output it then forwarded to one task (unmapped). We noticed that these tasks are being called twice. Is this expected in some way? This happened to me before, but I thought this was already solved. prefect 13.1 running on dask-kubernetes
    m
    • 2
    • 4
  • a

    Amit Gal

    12/09/2020, 3:53 PM
    Hey all, New to the community and Prefect in general, but a bit in love with it already 🙂 I have a basic architectural question, and I hope this is a good place to ask it - otherwise, please let me know! In a nutshell, I am looking to
    map
    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!
    j
    • 2
    • 8
  • s

    SImon Hawe

    12/09/2020, 3:59 PM
    Hello Prefect team. I have a question regarding the prefect context. Is it possible to set prefect context in one task (so on runtime) and use those values in other tasks? It works very well when running it locally but I have no success so far when deploying it to prefect cloud. As things late dates are set dynamically, there should be some way to do that.
    j
    • 2
    • 5
  • m

    Mitchell Bregman

    12/09/2020, 4:59 PM
    hey there — I am designing a flow that requires
    pyodbc
    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
    ?
    j
    • 2
    • 2
  • a

    Arthur Duarte

    12/09/2020, 6:10 PM
    Greetings! Could you please help me with a simple question? I created a duplicated prefect project, using the command:
    prefect create project "my-project"
    Can we also delete projects, using a similar command ?
    j
    m
    • 3
    • 5
  • s

    Sébastien

    12/09/2020, 9:36 PM
    New server, this error isn't telling much:
    #> 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?
    j
    • 2
    • 17
  • s

    Sébastien

    12/10/2020, 12:53 AM
    Dask not running mapped tasks in parallel - any ideas? (details: https://prefect-community.slack.com/archives/CL09KU1K7/p1607561409431800?thread_ts=1607549801.425600&amp;cid=CL09KU1K7)
    m
    j
    j
    • 4
    • 43
  • j

    Joseph

    12/10/2020, 2:18 AM
    Hello all. I'm part of a team evaluating Prefect for my employer. Is there any data available on the performance of various components with very large graphs? I have scenarios that could extend up to 10M nodes and would regularly run around 1M nodes.
    c
    • 2
    • 2
  • d

    Dotan Asselmann

    12/10/2020, 7:37 AM
    Hey, is it possible to use context value as a default for Parameter?
    m
    m
    +2
    • 5
    • 19
  • e

    Edison A

    12/10/2020, 9:03 AM
    Hello, I just read somewhere on the prefect website that prefect no-longer needs docker but I can't find a blogpost of webpage detailing that. Could you please help me with a link / confirmation? Have the tutorials been updated?
    m
    • 2
    • 3
  • a

    Alex Koay

    12/10/2020, 9:16 AM
    Does anybody know if there's a way to make prefect agents / prefect server log tracebacks for exceptions? Some of the errors get a little hard for me to debug.
    d
    • 2
    • 4
  • d

    Dali

    12/10/2020, 11:29 AM
    Hello hello dear folks, A very basic question - just started looking at the tool. If I understand correctly the cloud version deals only with UI, scheduling, etc. and we still need to provide our own infrastructure to host code (storage) and run the work (agents). There is no fully managed service. Am I following along correctly?
    m
    • 2
    • 9
  • d

    Dotan Asselmann

    12/10/2020, 12:56 PM
    Hi everyone. is it possible to set a task to run at the end of flow in any case. I want to run somekind of ‘cleanup’ task and i want it to run even if the flow is failing
    m
    • 2
    • 2
  • m

    Marc Lipoff

    12/10/2020, 2:57 PM
    Has anyone run into this issue when trying to run
    flow.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'
    a
    m
    • 3
    • 7
  • h

    Hamed Sheykhlou

    12/10/2020, 3:20 PM
    Hi guys. is there any way to securely pass the result of a task to the next task?
    m
    d
    • 3
    • 5
  • z

    Zach

    12/10/2020, 5:50 PM
    If I set the
    run_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?
    j
    • 2
    • 4
  • l

    liren zhang

    12/10/2020, 6:01 PM
    Hi Community, I am trying to save the execution log to local file system in a hybrid prefect cloud with local runner mode with the following code
    import 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")
    m
    • 2
    • 22
  • l

    liren zhang

    12/10/2020, 6:01 PM
    I can seem to find where the log was saved to
  • l

    liren zhang

    12/10/2020, 6:02 PM
    I am running the prefect agent on a virtual python env
  • l

    liren zhang

    12/10/2020, 6:03 PM
    I was hoping the following logs in the cloud can be save in my local execution environment.
  • c

    Christian

    12/10/2020, 7:05 PM
    Hi all. I'm trying to implement a docker storage flow on a prefect server instance on a workstation in our network. I build a custom docker base image and push it to docker.io. However, I get an error registering my flow... Not sure where this might originate?
    requests.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/dataflow
    m
    • 2
    • 8
  • s

    Shawn Marhanka

    12/10/2020, 7:40 PM
    Hi all, is anyone randomly getting errors from StartFlowRun tasks.
    Unexpected 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.
    👀 1
    d
    m
    • 3
    • 8
  • s

    Sean Talia

    12/10/2020, 7:40 PM
    has anyone ever encountered this issue before? I'm orchestrating a flow of flows, where the parent flow is running in a docker container and is launching its child flows in sibling docker containers, and am getting this error when my parent flow tries to launch my child flow:
    Traceback (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.8
    👀 1
    m
    • 2
    • 8
  • s

    Sean Talia

    12/10/2020, 7:42 PM
    wow, that is crazy timing
  • k

    Kevin Weiler

    12/10/2020, 8:13 PM
    Hi All! I’m trying to get stdout from my tasks to go to the UI (with the docker agent) and not having any luck. I’m setting the
    PREFECT__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?
    m
    j
    +2
    • 5
    • 48
  • p

    Pedro Machado

    12/11/2020, 12:28 AM
    Hi there. We are having some issues getting flow concurrency limits to work in our set up. This is what we have: • Single docker agent started with two labels: 
    restricted
     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 run
    👀 1
    c
    • 2
    • 4
Powered by Linen
Title
p

Pedro Machado

12/11/2020, 12:28 AM
Hi there. We are having some issues getting flow concurrency limits to work in our set up. This is what we have: • Single docker agent started with two labels: 
restricted
 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 run
👀 1
c

Chris White

12/11/2020, 12:41 AM
Hi Pedro! Thanks for the detailed analysis - there is a chance this is a bug; could you spin up two Docker agents, one with the
restricted
label and one with the
unrestricted
label and let me know if the behavior is any different?
Update for you: I believe this is actually an easy-to-fix bug in which the concurrency restriction on one label was preventing any other work from being released to that agent; I’ve already got a fix in the works that we can get released within the hour 👍
🙌 1
p

Pedro Machado

12/11/2020, 3:50 AM
Great! We can test tomorrow. Just let me know.
c

Chris White

12/11/2020, 3:51 AM
The fix has been released - let me know if it resolved the issue whenever is convenient
View count: 1