https://flyte.org logo
k

karthikraj

09/30/2022, 2:52 AM
Hi, I have a custom plugin named MyCustomTask written in a python file(say mycustomtask.py). How can I include this in the Flyte environment so that any one uses this plugin should be able to import and use it like other default plugins. Example: This is how we import Snowflake task ->
from flytekitplugins.snowflake import SnowflakeConfig, SnowflakeTask
. I need to do the same thing with my custom plugin too. ->
from flytekitplugins.mycustomtask import MyCustomTask
or similarly.
s

Samhita Alla

09/30/2022, 7:30 AM
@karthikraj, please refer to https://docs.flyte.org/projects/cookbook/en/latest/auto/core/extend_flyte/user_container.html guide. If you’d like to publish one, feel free to create a PR to the flytekit repo. Ensure your plugin is in the
flytekit/plugins
directory. You can take a look at the other plugins’ code for reference. Would you mind letting me know what this custom task is?
k

karthikraj

09/30/2022, 8:31 PM
Actually, We will use a plugin with our custom use case which is specific to our account. It might not a generic one to be used by all the developers. Any recommended way to place this custom file and use within our flyte environment only? Example: Airflow allows users creating custom Operators and it can be placed in the plugins/ folder and can be imported in the DAG files. This doesnt need changes to airflow module. I am checking if we can do the similar process here? @Samhita Alla
s

Samhita Alla

10/03/2022, 4:34 AM
Yeah, you can do that. You’ll have to create a custom task in your code file or a different Python module and import that task into your code, on the lines of https://docs.flyte.org/projects/cookbook/en/latest/auto/core/extend_flyte/user_container.html.
2 Views