Afternoon folks. Wondering if anyone has advice. Struggling to get a simple/common Python pattern working when using
DockerRun
run_config with
Github
storage. Have the following project structure in the Github repo:
etl/
├── util/
│ ├── __init__.py
│ ├── util_vault.py
├── __init__.py
├── runner.py
The
util_vault.py
looks like:
from prefect.client import Secret
class UtilVault:
@staticmethod
def get_secret_simple(name):
return Secret(name).get()
The
runner.py
looks like:
from prefect import Flow, task, context
from prefect.run_configs import DockerRun
from prefect.storage import GitHub
from util.util_vault import UtilVault
logger = context.get("logger")
@task
def hello_secrets():
secret = UtilVault.get_secret_simple('GITHUB_ACCESS_TOKEN')
<http://logger.info|logger.info>('secret = %s', secret)
with Flow(name='hello_world') as flow:
hello_secrets()
flow.storage = GitHub(
repo='<username>/<repo>',
path='etl/runner.py',
access_token_secret='GITHUB_ACCESS_TOKEN',
)
flow.run_config = run_config=DockerRun(
image='<registry-name>/prefect-runner-base-image:1.0.0',
)
When I run this task, I get
ModuleNotFoundError: No module named 'util'
. Any help would be much appreciated.