https://prefect.io logo
#prefect-server
Title
# prefect-server
u

김응진

05/25/2021, 9:25 AM
Hi I have a problem running a test flow. when i run a test code below.
Copy code
def test_flow():
    client = prefect.Client(api_token="dddd")
    id = client.register(google_ads_flow, project_name='pipeline-test')
    client.create_flow_run(
        flow_id=id,
        parameters=dict(account_id=46)
    )
got
Failed to load and execute Flow's environment: TypeError("missing a required argument: 'date'")
error. There is nothing like date parameter or something in my flow.
k

Kevin Kho

05/25/2021, 1:14 PM
Hi @김응진! Can I see the
google_ads_flow
?
u

김응진

05/26/2021, 1:26 AM
Copy code
with Flow("GoogleAds-ETL",
          run_config=DockerRun(image="<http://registry.gitlab.com/xxxxx/xxxxxx:latest|registry.gitlab.com/xxxxx/xxxxxx:latest>", labels=["stag"])) as flow:
    account_id = Parameter('account_id', default=None)
    <http://logger.info|logger.info>(f'account_id : [{account_id}]')
    account_secret = get_account_secret(account_id)
    # Extract
    ad_managers = extract_googleads_ad_managers(account_secret)
    ad_campaigns = extract_google_ad_campaigns(account_secret)
    ad_groups = extract_google_ad_groups(account_secret)
    ads = extract_google_ads(account_secret)
    ad_daily_reports = extract_google_ad_daily_reports(account_secret)

    # Load
    load_google_ad_datas(ad_managers, ad_campaigns, ad_groups, ads, ad_daily_reports)

flow.storage = GitLab(repo="0000000", path="GoogleAdsETL.py",
                      access_token_secret="GITLAB_PERSONAL_ACCESS_TOKEN")
@Kevin Kho
k

Kevin Kho

05/26/2021, 1:32 AM
I think this means you have a function that is expected date but does not got it. Maybe check the logs on Prefect?
u

김응진

05/26/2021, 1:33 AM
umm but I don't have a function with a date
k

Kevin Kho

05/26/2021, 1:36 AM
Couple of things to try. Maybe you can try using
flow.run()
to debug? If the Docker container is still up, you can try getting the logs. I feel you have a task that uses a function that is asking for the
date
to be passed in.
u

김응진

05/26/2021, 1:36 AM
thank you! I'll try
k

Kevin Kho

05/26/2021, 1:36 AM
It might not be your tasks but it could be a function your tasks are calling
1
You can also try running the flow with debug logs by passing
env={'PREFECT__LOGGING__LEVEL':'DEBUG'}
to the
DockerRun
. I'm not sure if this will get the logs you want.
Do you work with jaehoon? I feel I've seen him post similar code 😆
u

김응진

05/26/2021, 1:40 AM
Right hahaha. He is my colleague. We are evangelist of prefect in korea.
marvin 1
😆 2
2 Views