Hi all - question about disabling Prefect. I have ...
# ask-community
m
Hi all - question about disabling Prefect. I have a script start.py. There are two execution cases: 1. Automated execution per deployment that I have set up, and 2. Manual execution from linux CLI e.g. python start.py In Case 2, I would like to disable Prefect, meaning I'd like the code to execute as if there were no @flow and @task decorators. Is there a convenient way to do this? I have through the docs and searched on the galactic interweb, but to no avail. Any suggestions / ideas would be much appreciated. Rgs, Mike
n
hi @Mike Loose - hmm do you want to entirely no-op "prefect stuff" or do you just want to avoid api usage for the second case? if the former, you'd probably have to monkey patch the decorators to make them pass through if the latter, you can use `prefect_test_harness` , which will just run everything against an ephemeral api/db
the tricky part about the first option is that task / flow decorated functions expose methods (like
map
or
with_options
) that you'd have to include in the patched-in thing in order for the no-op'd code to actually run
m
I tried Option 1 but it quickly exceeded my abilities. I'll work w/ prefect_test_harness and see how that goes.
n
yeah I would take a step back and ask whether that's really the problem you want to solve here. can you explain at a high level what the difference between these cases are? there's likely a more satisfying approach