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

Determine scheduler from component level #824

Open
ryxli opened this issue Feb 14, 2024 · 1 comment
Open

Determine scheduler from component level #824

ryxli opened this issue Feb 14, 2024 · 1 comment

Comments

@ryxli
Copy link
Contributor

ryxli commented Feb 14, 2024

❓ Questions and Help

Please note that this issue tracker is not a help form and this issue will be closed.

Before submitting, please ensure you have gone through our
documentation.

Question

Is it possible to tell or fill in at runtime which scheduler gets used in component logic? For example, if I have a ddp component, within the component, before I return specs.AppDef, can I set for example a macro that would tell me which scheduler this component gets ran with?

For example, I want to be setting some environment variables but differentiate based on which scheduler gets used.

@ryxli
Copy link
Contributor Author

ryxli commented Feb 14, 2024

For example, if I want component level behavior specific to local schedulers (local, docker), I could for example add an additional redundant parameter --local in the component to specifiy that logic. But I can stick with default behavior for cloud based scheduler, like aws, gcp, etc...

Instead, wondering if it is possible to determine the scheduler from the component and define behavior there for specific schedulers, rather than vice versa. In this way, I can modify the component rather than multiple different schedulers.

Otherwise the only place where this scheduler metadata is propogated is ENV TORCHX_JOB_ID as part of runner api,

        - name: TORCHX_JOB_ID
          value: aws_batch://torchx/job_name

Another unideal hacky solution

cmd = [
  "$(echo $TORCHX_JOB_ID | cut -d':' -f1)"
]

Otherwise the only other way seems to be through macros through string comparisons which also seems unideal

$( [[ '{specs.macros.rank0_env}' == 'TORCHX_RANK0_HOST' ]] && echo local_docker || echo {default_scheduler_name()})

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

No branches or pull requests

1 participant