https://prefect.io logo
Title
n

Numline1

08/29/2022, 6:20 PM
Hey guys, so I managed to do my first deployment (😛arty-parrot: ) but the scheduled tasks are failing with this weird error 😞 Any help appreciated
k

Khuyen Tran

08/29/2022, 6:21 PM
Can you share you flow code?
n

Numline1

08/29/2022, 6:22 PM
Not entirely, it's a proprietary company software 😞 I can share parts of it though, one sec please
s

Serina

08/29/2022, 6:22 PM
How did you create the deployment?
n

Numline1

08/29/2022, 6:23 PM
@Serina using the CLI, let me dig up the command. Also, here's part of the source code:
### Flows
@flow
def collect_stats_by_politician(since):
    a = get_interactions_by_politician(since)
    b = get_ads_spendings_by_politician(since, wait_for=[a])

@flow
def collect_stats_by_political_party(since):
    a = get_interactions_by_political_party(since)
    b = get_ads_spendings_by_political_party(since, wait_for=[a])

@flow
def collect_political_stats(days):
    since = datetime.today() - timedelta(days=days)

    clear_politicians_stats(since, 'interactions')
    clear_politicians_stats(since, 'ads_spendings')

    collect_stats_by_politician(since)

    clear_political_parties_stats(since, 'interactions')
    clear_political_parties_stats(since, 'ads_spendings')

    collect_stats_by_political_party(since)

load_dotenv()

argument_list = sys.argv[1:]
options = "hmo:"
long_options = ["days="]

arguments, values = getopt.getopt(argument_list, options, long_options)

days = [item for item in arguments if item[0] == '--days']

collect_political_stats(int(days[0][1]) if len(days) else 3)
🤔 1
@Serina so I believe it was
source /home/prefect/prefect_venv/bin/activate && prefect deployment build /home/prefect/flows/politicssocial/collect_political_stats.py:collect_political_stats -n politicssocial_collect_political_stats -q politicssocial
There are the processes running on the server, so I believe they're in that venv
prefect   344495   50115  0 Aug27 ?        00:00:03 /home/prefect/prefect_venv/bin/python /home/prefect/prefect_venv/bin/prefect orion start
prefect   344519  344495  0 Aug27 ?        00:21:19 /home/prefect/prefect_venv/bin/python /home/prefect/prefect_venv/bin/uvicorn --factory prefect.orion.api.server:create_app --host 127.0.0.1 --port 4200
prefect   344561   50115  0 Aug27 ?        00:06:25 /home/prefect/prefect_venv/bin/python /home/prefect/prefect_venv/bin/prefect agent start -q politicssocial
k

Khuyen Tran

08/29/2022, 7:35 PM
Did you run the flow code successfully? (not through the deployment)
:upvote: 1