Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable running custom scripts before executing a component #499

Open
RobbeSneyders opened this issue Oct 5, 2023 · 1 comment
Open

Enable running custom scripts before executing a component #499

RobbeSneyders opened this issue Oct 5, 2023 · 1 comment

Comments

@RobbeSneyders
Copy link
Member

Some components require running a custom script before executing the component (e.g. model compilation at runtime).
This works fine for the local runner since we can change the entrypoint from:

ENTRYPOINT ["fondant", "execute", "main"]

to

ENTRYPOINT ["entrypoint.sh"]

where entrypoint.sh can contains the following:

# Example of custom script
/bin/bash ./build.sh

# Component execution 
echo "Executing command: fondant execute main.py $@"
fondant execute main.py "$@"

However, the entrypoint command is currently hardcoded for kubeflow and should be custom

b617ef4

We should find a way to force the running of a custom script before executing the component

@RobbeSneyders RobbeSneyders converted this from a draft issue Oct 5, 2023
@PhilippeMoussalli
Copy link
Contributor

I am not sure if we should provide a generic way of implementing this, you could still copy over the bash script and execute it either at at the beginning of the file

import os

script_path = 'script.sh'

os.system(f'bash {script_path}')

or the __init__/ transform method of the component depending on whether it's a one time or recurring script per partition (will probably only be at the __init__ level)

import os

class customComponent(PandasTransformComponent):
        os.system( 'script.sh'')
                   

This has the advantage that the user does not need to know that they would to have to execute fondant execute main.py "$@" after the bash script is executed

@RobbeSneyders RobbeSneyders moved this from Backlog to Breakdown in Fondant development Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Breakdown
Development

No branches or pull requests

2 participants