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

add slurm #1

Merged
merged 4 commits into from
Nov 13, 2024
Merged

add slurm #1

merged 4 commits into from
Nov 13, 2024

Conversation

madhur-ob
Copy link
Collaborator

@madhur-ob madhur-ob commented Nov 5, 2024

requires Netflix/metaflow#2134 to be merged first

Tested with the following flow with the Oleg2 stack:

from metaflow import FlowSpec, step, slurm, pypi, environment

class Movies(FlowSpec):

    @step
    def start(self):
        self.titles = ['Stranger Things', 'House of Cards', 'Game of Thrones']
        self.next(self.mid, foreach='titles')

    @environment(vars={
        "AWS_ACCESS_KEY_ID": "XXXX",
        "AWS_SECRET_ACCESS_KEY": "YYYY"
    })
    @slurm(
        username="ubuntu",
        address="18.236.81.10",
        ssh_key_file="~/Desktop/outerbounds/parallelcluster/madhur-slurm.pem",
    )
    @pypi(python='3.10.11', packages={'pandas': '2.1.1', 'numpy': '1.24.4', 'boto3': '1.35.40', 'requests': '2.32.3'})
    @step
    def mid(self):
        import pandas as pd

        self.series = pd.Series(['%s processed' % self.input])
        print(self.series)
        self.next(self.join)

    @pypi(python='3.10.11', packages={'pandas': '2.1.1', 'numpy': '1.24.4'})
    @step
    def join(self, inputs):
        import pandas as pd
        
        df = pd.DataFrame([inp.series for inp in inputs])
        df.columns = ["Value"]
        self.df = df.reset_index(drop=True)
        print(self.df)
        self.next(self.end)

    @step
    def end(self):
        print("Phew!")

if __name__ == '__main__':
    Movies()

@madhur-ob madhur-ob merged commit b4d32e5 into outerbounds:main Nov 13, 2024
@madhur-ob madhur-ob deleted the slurm-integration branch November 13, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants