https://prefect.io logo
Docs
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
  • d

    daniel

    03/15/2021, 9:19 PM
    Does anybody else have issues with actually installing perfect? Running `pip install perfect`only gets me this decorator
    k
    a
    • 3
    • 5
  • a

    asm

    03/15/2021, 10:22 PM
    howdy! I tried to reset my password but it doesn't seem to have taken, and when I try and request a reset it directs me to this page: https://universal.prefect.io/help/login
    n
    • 2
    • 2
  • a

    asm

    03/15/2021, 10:22 PM
    wondering how I can request a password reset now?
  • c

    Charles Liu

    03/15/2021, 11:40 PM
    Has anyone else had funky k8/fargate scaling behavior with Prefect? Would love some second opinions. Edit: For some context, with an S3/K8 config, I can reach slightly above 30ish% utilization on my instance, and my cluster has a fargate profile configured for it. Although I'm hitting somewhere in the low 30's, there are somehow tasks that fail outright with a heartbeat error, and presumably when I was running Docker/K8 which manifested as an HTTP error. These tasks will intermittently succeed, which is why I'm a little confused, but will otherwise fail as I'm trying to load test our instance presumably due to lack of adequate resources. On the frontend, I'm running six tasks scheduled on a 1 min interval. 4 out of the 6 tasks run just fine consistently. The two that crash are variants of one of our heavier flows, and alternate between failure and success (more failures).
  • s

    Seonghwan Hong

    03/16/2021, 6:09 AM
    I use aws ecr for prefect docker storage. I log in to ECR periodically with the following command "`aws ecr get-login-password --region yourregion | docker login --username AWS --password-stdin yourregistryid.dkr.ecr.yourregion.amazonaws.com`" because the ECR token is expired after 12 hours. But In prefect agent, docker client is not updated when the token is expired. So every 12 hours, I have got 404 error and have to restart my agent.
    c
    • 2
    • 2
  • t

    Timo

    03/16/2021, 10:45 AM
    I tried to register a flow to Prefect cloud and store it on S3. AWS_CREDENTIALS is set as secret within Prefect Cloud. If I register the flow i receive the following error:
    botocore.exceptions.NoCredentialsError: Unable to locate credentials
    I register the flow with the following method:
    flow.storage = S3(
        bucket="prefect-flows",
        secrets=["AWS_CREDENTIALS"],
    )
    flow.register(project_name="abc")
    The backend is set to cloud and I logged in successfully (
    prefect auth login ...
    ) How could I use the AWS_CREDENTIALS secret which is set in the cloud?
    c
    • 2
    • 2
  • m

    Mark Koob

    03/16/2021, 12:47 PM
    Hello prefecteers! I'm having some trouble with what appears to be a deadlock. I've gotten a minimum reproducible example that may or may not be the cause for my issue, which centers around tasks that submit additional work to the dask client which serves as the executor. I am using prefect core with the dask executor. Here is the example:
    Untitled
    m
    m
    • 3
    • 6
  • z

    Zach Khorozian

    03/16/2021, 3:43 PM
    Hello, I’d like to schedule multiple runs of a parametrized flow at the same time, with each run having a different parameter input. I’m thinking I can either build a parent flow that uses the python client api to initiate each child flow run, or maybe its possible to have a parentless approach where multiple runs of the flow are on the same schedule, each with a different input. Another possible solution using a parentless approach could involve an external data source that stores the set of parameters and keeps track of whether each one has been picked up by a flow run. I’m looking for best practice as I don’t think these are great approaches. Would appreciate any help here! Thank you.
    c
    • 2
    • 5
  • b

    Brett Naul

    03/16/2021, 4:54 PM
    hi @nicholas, following up on this thread: we still get logged out every day and have to log back in in the morning, which causes all of our open tabs to redirect to 404s. is this daily logout the intended behavior, and is there a way to avoid the 404'ing?
    👀 1
    n
    c
    • 3
    • 4
  • c

    Charles Liu

    03/16/2021, 5:44 PM
    So I'm digging into the prefect repo and see that AWS credentials are handed off as a credential dict to a MagicMock() function. The reason I'm looking is because passing CodeCommit(secrets=) does not work outright whereas S3(secrets=) does work, and our flows run remotely. While trying to pass in client_options={'credentials':['AWS_Credentials']} yields "TypeError("get_boto_client() got multiple values for keyword argument 'credentials'",)". This makes sense as this seems to be how prefect calls boto:
    @property
        def _boto3_client(self):  # type: ignore
            from prefect.utilities.aws import get_boto_client
    
            kwargs = self.client_options or {}
            return get_boto_client(resource="codecommit", credentials=None, **kwargs)
    and then the get_boto_client func:
    def get_boto_client(
        resource: str,
        credentials: Optional[dict] = None,
        region_name: Optional[str] = None,
        profile_name: Optional[str] = None,
        **kwargs: Any
    ) -> "botocore.client.BaseClient":
    but it seems it holds onto None and doesn't let anything else pass. Is there anyone else here that has successfully connected to CodeCommit through Prefect?
    m
    • 2
    • 8
  • c

    Charles Liu

    03/16/2021, 8:28 PM
    I'm suddenly locked out from being able to update my flows with the following error: My flow has a registration statement at the very end and it shows up on the front end, but I can't run any of my flows anymore. "CRED_secrets" does not have a -1 next to it in my flow and is also titled CRED_secrets on the front end secrets module. Context: this is a simple flow that has run consistently prior to this error. CRED_secrets is being called with client_secrets=PrefectSecret("CRED_secrets").
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/prefect/engine/flow_runner.py", line 245, in run
        parameters=parameters,
      File "/usr/local/lib/python3.6/site-packages/prefect/engine/cloud/flow_runner.py", line 402, in initialize_run
        raise KeyError(msg) from exc
    KeyError: 'Task slug CRED_secrets-1 not found in the current Flow; this is usually caused by changing the Flow without reregistering it with the Prefect API.'
    m
    • 2
    • 16
  • m

    matta

    03/16/2021, 9:35 PM
    Upgrading from 0.13.19 to the latest version rocked! One flow in particular went from 35 minutes to 6 minutes. Just out of curiosity, what might have caused that huge speedup? Curious as to what went on under the hood between 0.13.19 and 0.14.12!
    🚀 2
    m
    m
    • 3
    • 3
  • i

    itay livni

    03/16/2021, 10:34 PM
    Hi - I am running into an issue with
    PrefectSecret
    and
    coiled
    . Posted the question on stack in case somebody else runs into this. https://stackoverflow.com/questions/66664086/how-does-one-use-prefect-cloud-secrets-with-coiled
    c
    • 2
    • 7
  • c

    CA Lee

    03/17/2021, 1:11 AM
    Dear all, trying to figure out the difference between using a task class and a task decorator
    from prefect import task, Task
    
    # Example 1
    
    class Example(Task):
      def run(self, **kwargs):
        do something
    
    # Example 2
    
    @task
    def example():
      do something
    In particular, how do I force a rebuild of the second task (using decorator)? Running into some issues running flows using ECS / ECR, where the task would not get rebuilt if using decorator format
    n
    • 2
    • 5
  • s

    S K

    03/17/2021, 4:36 AM
    Team, 1. Please advise on how to get notified when the prefect agent stops due to ec2 restart...we are using backend as the server and not the cloud version 2. How to check in the shell script to see if the agent is already running, if not start the agent
  • m

    Morgan Omind

    03/17/2021, 10:18 AM
    Hello. We are using prefect with its free plan, and yesterday when I tried to deploy a new flow, I got this error message: 'prefect.utilities.exceptions.ClientError: [{'path': ['create_flow_from_compressed_string'], 'message': 'This tenant already has the maximum number of flows.', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]' I looked for this message in this slack, and the two related topics are using paid plans. Could you explain me if it is related to free vs paid plans please, because I cannot find this information in your website plans comparison page? And how could we solve this limitation? (notice than I checked, and we currently have 25 flows deployed in total amongst our different prefect projects). Best !
    t
    j
    • 3
    • 3
  • t

    Tim Enders

    03/17/2021, 2:08 PM
    I have a question about Prefect Cloud and FlowRunners. It looks like, if I want to loop a flow based on state, I need to run it through a FlowRunner. How would I do that through Prefect Cloud?
    j
    • 2
    • 24
  • s

    Sven Teresniak

    03/17/2021, 2:43 PM
    Is there any documentation regarding cleaning the postgres in a standalone cluster? Is the database growing forever? Can I trigger deletion of e.g. "more than 30d old" state (flow runs, logs)? Mayby using a mutation or api call? (I'm not talking about STORAGE or RESULT) Edit: found an old answer: no automatic process available. 😞
  • k

    Karolína Bzdušek

    03/17/2021, 2:46 PM
    Hi all, where I can find details in docs about this?
    Realese 0.14.11:
    Added 
    project_name
     /`project_id` to flow run execution context in orchestrated flow runs
    j
    m
    • 3
    • 4
  • m

    Matthew Blau

    03/17/2021, 3:20 PM
    Hello all, I have what I think is a simple question: I have a flow that creates a container, waits on the container, and then gets the container logs. How can I have it throw an error and bail out on things if the WaitOnContainer has a failure in it? I have a slack notifier set up to only output failure, but it is not notifying upon failure of WaitonContainer. Flow code for reference in the thread
    i
    • 2
    • 2
  • b

    Braun Reyes

    03/17/2021, 5:22 PM
    map throttling with cloud task concurrency and dask cluster with multiple workers! 🔥 🔥 🔥
    🔥 6
  • b

    Braun Reyes

    03/17/2021, 5:44 PM
    interesting issue I created here in case anyone has ever run into issues using case and skip_on_upstream_skip=False https://github.com/PrefectHQ/prefect/issues/4264 there is a work around that is helpful in there
  • s

    S K

    03/17/2021, 6:09 PM
    Hi all, what kind of permission does the Postgres "prefect_user" in config.toml file needs...I am seeing that the prefect server is starting only if the postgres "prefect_user" is part of rds_superadmin, otherwise getting error "Could not upgrade the Database!". All I am trying to do is to avoid assigning elevated access to postgres "prefect_user" id, because for prefect we are using postgres that is used by our OLTP applications. Also advise what kind of database upgrade happens every time the prefer server is started.
    👀 1
    c
    • 2
    • 1
  • c

    Calvin Pritchard

    03/17/2021, 6:43 PM
    How do I save the results of a task to the local filesystem? Suppose I have a workflow
    test.py
    from prefect import task, Flow
    from prefect.engine.results import LocalResult
    
    OUTPUT_DIR = './outputs'
    
    
    @task(target='x.txt', checkpoint=True, result=LocalResult(dir=OUTPUT_DIR))
    def saver():
        return 10
    
    
    with Flow('example') as flow:
        saved = saver()
    
    flow.run()
    when I run
    python test.py
    I expect a file tree like
    tree
    .
    ├── outputs
    │   └── x.txt
    └── test.py
    but when I run
    python test.py
    I don't see an
    x.txt
    file
    .
    ├── outputs
    └── test.py
    I am using
    prefect==0.14.12
    What do I need to do to get
    prefect
    to save (and persist) file results?
    j
    • 2
    • 3
  • j

    jeff n

    03/17/2021, 7:13 PM
    I have a flow that I want to use to backfill data for about 9 years which is going to equal around 3000 jobs. I am curious if Prefect Cloud will have any issues queuing up so many jobs and then just running them sequentially.
    c
    • 2
    • 2
  • j

    Jacob Hayes

    03/17/2021, 7:52 PM
    I'm trying to register a new flow version (ie: same name) and kick off a run, but the updated labels don't seem to be getting used so it gets run on the wrong agent. Is there a way to set label per-flow or per-flow-run that override the flow_group?
    j
    • 2
    • 6
  • j

    Josh

    03/17/2021, 8:13 PM
    Is there a good way to log to Prefect from a jupyter notebook running in
    ExecuteNotebook
    ?
    j
    m
    • 3
    • 7
  • j

    Justin Essert

    03/17/2021, 8:33 PM
    Hey all, @Adithya Ramanathan and I are running into some issues with Prefect’s mapping functionality and would appreciate some more information on the mechanics of mapping in Prefect! My understanding is that currently, having two consecutive mapped components allows you to run the second component on the same level of mapping as the first component, like in one of the examples in the docs:
    from prefect import Flow, task
    
    @task
    def add_ten(x):
        return x + 10
    
    with Flow('iterated map') as flow:
        mapped_result = add_ten.map([1, 2, 3])
        mapped_result_2 = add_ten.map(mapped_result)
    This allows you to map the first add_ten call to the three elements in the list, and then to map the second add_ten call to the three outputs from the first call. Instead of returning a single int from the add_ten function, we want it to return an list of ints and continue to fan-out (to 6 elements in the example below):
    @task
    def add_ten(x):
        return [x + 10, x]
    
    with Flow('iterated map') as flow:
        mapped_result = add_ten.map([1, 2, 3])
        mapped_result_2 = add_ten.map(mapped_result)
    Is this something that is supported by Prefect, or can you only have 1 fan-out per map/reduce?
    j
    • 2
    • 3
  • j

    Josh Greenhalgh

    03/17/2021, 9:18 PM
    Have just come across this error when trying to use my own custom decorator;
    ValueError: Tasks with variable positional arguments (*args) are not supported, because all Prefect arguments are stored as keywords. As a workaround, consider modifying the run() method to accept **kwargs and feeding the values to *args.
    Has anyone had any luck using their own? The one I want to use is this;
    def jitter(func: Callable) -> Callable:
        """
        For use with short running mapped tasks
        to avoid overwhelming the api server
    
        calls function sleeps for random period
        """
    
        def wrapped(*args, **kwargs):
            res = func(*args, **kwargs)
    
            sleep(random.gauss(1.2, 0.2))
            return res
    
        return wrapped
    Basically just waits for a while and does so randomly so lots of short running mapped tasks don't all hit my api server (on k8s) - I much prefer this than having sleeps in my actual task code
    j
    • 2
    • 6
  • m

    Manik Singh

    03/18/2021, 6:56 AM
    Are there any code examples using the
    files
    arg for the Docker storage? I'm trying to use some common scripts across flows packaged into separate Docker images. I think the
    files
    arg will serve my purpose, but the Prefect API docs suggest to use absolute paths, while relative paths would make more sense.
    j
    • 2
    • 1
Powered by Linen
Title
m

Manik Singh

03/18/2021, 6:56 AM
Are there any code examples using the
files
arg for the Docker storage? I'm trying to use some common scripts across flows packaged into separate Docker images. I think the
files
arg will serve my purpose, but the Prefect API docs suggest to use absolute paths, while relative paths would make more sense.
j

Jenny

03/18/2021, 3:40 PM
Hi @Manik Singh - does this help you? https://docs.prefect.io/core/idioms/script-based.html#using-script-based-flow-storage
View count: 3