Trying to do something SUPER basic, not sure why i...
# ask-community
z
Trying to do something SUPER basic, not sure why its not working though (I’d imagine I’m missing something very obvious). • I have the k8s agent deployed and querying for flow runs • I have my flow registered with github storage and can see it in the UI When I try to run it, however, it just stays in the scheduled state forever. What am I doing wrong? (Flow below). I realize I’m not specifying a docker image, but figured since its a kwarg there was a default it would fall back on. Could be what I’m missing?
Copy code
from prefect import task, Flow
from prefect.run_configs import KubernetesRun
from prefect.storage import GitHub


@task()
def print_hello(name: str):
    print(f"hello {name}!")


with Flow(
        "Example", 
        storage=GitHub(
            repo="Simplebet/sbprefect", 
            path="sbprefect/flows/example.py", 
            access_token_secret="GITHUB_ACCESS_TOKEN")
) as flow:
    example_task = print_hello("world")
    flow.run_config = KubernetesRun()
note I have both the agent and flow registered to prefect cloud
k
Hi @Zach Schumacher! Is the k8s agent deployed and querying for flow runs, but not picking up the scheduled flow?
z
yeah, exactly
k
This sounds like it may be a label issue? What are the labels on your flow and agent?
z
agent logs below
Copy code
____            __           _        _                    _
4/19/2021 2:54:12 PM |  _ \ _ __ ___ / _| ___  ___| |_     / \   __ _  ___ _ __ | |_
4/19/2021 2:54:12 PM | |_) | '__/ _ \ |_ / _ \/ __| __|   / _ \ / _` |/ _ \ '_ \| __|
4/19/2021 2:54:12 PM |  __/| | |  __/  _|  __/ (__| |_   / ___ \ (_| |  __/ | | | |_
4/19/2021 2:54:12 PM |_|   |_|  \___|_|  \___|\___|\__| /_/   \_\__, |\___|_| |_|\__|
4/19/2021 2:54:12 PM                                            |___/
4/19/2021 2:54:12 PM 
4/19/2021 2:54:12 PM [2021-04-19 18:54:12,774] INFO - agent | Starting KubernetesAgent with labels ['d', 'e', 'v']
4/19/2021 2:54:12 PM [2021-04-19 18:54:12,774] INFO - agent | Agent documentation can be found at <https://docs.prefect.io/orchestration/>
4/19/2021 2:54:12 PM [2021-04-19 18:54:12,774] INFO - agent | Agent connecting to the Prefect API at <https://api.prefect.io>
4/19/2021 2:54:12 PM [2021-04-19 18:54:12,858] INFO - agent | Waiting for flow runs...
4/20/2021 10:07:04 AM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/20/2021 7:05:44 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/20/2021 8:18:20 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/21/2021 4:16:12 AM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/21/2021 2:00:17 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/22/2021 7:54:02 AM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/22/2021 6:38:02 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/22/2021 9:10:21 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/22/2021 11:52:03 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/23/2021 12:06:58 AM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/23/2021 7:58:36 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/24/2021 6:05:31 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/24/2021 6:05:48 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/24/2021 6:06:07 PM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
4/25/2021 7:40:00 AM <WARNING:urllib3.connectionpool>:Retrying (Retry(total=5, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='<http://api.prefect.io|api.prefect.io>', port=443): Read timed out. (read timeout=15)",)': /
no labels on the flow, the label on the agent is [‘d’, ‘e’, ‘v’], which was probably a mistake by our sre team 🤣
k
Lol. The agent gets a list of strings, they probably just gave a string with Python treats as an iterable. I think this is related to your problem though because a flow with no labels can only be picked up by agents with no labels. Docs here
z
did I read environments are deprecated? what is the correct recipe for isolating environments (dev, staging, etc.)
k
Environments were more about Flow Environments. FargateTaskEnvironment, KubernetesJobEnvironment. They have been replaced with RunConfigs like
ECSRun
,
KubernetesRun
,
DockerRun
. Environments like dev, staging are more handled by users in their own way. Some use labels so that flows only get picked up by infrastructure with the same labels. For example,
dev
and
prod
as labels like what you had.
Some other users use Projects to isolate their flows.
z
makes sense. thx for the help!
👍 1
k
Anytime!