Hi all, Is it possible to use module name instead ...
# prefect-community
v
Hi all, Is it possible to use module name instead of full file name in orion deployments when using “native” storage? In prefect1 that was possible to specify just module nam, e.g.
flow.storage = Module('samples.flow_orion')
Now i’m kind of forced to specify exact full filename, even though I have file in python path. That’s very inconvenient for cases when developers have no control over the final image layout. That’s how I create deployments now:
Copy code
entrypoint = 'samples.flow_orion:entrypoint' # this is just module, available on path
flow = prefect.utilities.importtools.import_object(entrypoint)

# here is path/entrypoint i need to specify path. could I use module name instead?
deployment = Deployment.build_from_flow(
    name=flow.name,
    flow=flow,
    work_queue_name="kubernetes",
    skip_upload=True,
    infrastructure=KubernetesJob(
        image=image,
        namespace='prefect2',
        job=k8s_template_orion(flow)
    ),
    path='/app/lib/python3.9/site-packages/samples/', # TODO 
    entrypoint='flow_orion.py:entrypoint'
)
deployment.apply()
Did i miss how to use module name instead of path?
1
a
that’s the purpose of entrypoint — instead of module, you specify the path to the flow e.g. flows/samples.pyfloworion I believe switching to CLI will make things easier to understand, check out this blog post and https://discourse.prefect.io/t/prefect-deployments-faq-pdf/1467
v
are there any plans to backport module as well? if there are some advantages of entrypoint - both approaches could coexist. But "module" was really handy. In my option it's more pythonic way, more similar to normal python modules.
a
well, entrypoint works the same way as module, you can solve that problem already