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

include clone commands in setup steps #62

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed

- `BeakerLaunchConfig.setup_steps` should now include steps to clone your repo (which it will by default). This change allows support for private repos.

## [v1.4.0](https://github.com/allenai/OLMo-core/releases/tag/v1.4.0) - 2024-10-02

### Changed
Expand Down
4 changes: 4 additions & 0 deletions src/olmo_core/internal/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ def build_common_components(
BeakerEnvSecret(name="WEKA_ENDPOINT_URL", secret="WEKA_ENDPOINT_URL"),
],
setup_steps=[
# Clone repo.
'git clone "${REPO_URL}" .',
'git checkout "${GIT_REF}"',
"git submodule update --init --recursive",
# Setup python environment.
"conda shell.bash activate base",
"pip install -e '.[all]'",
Expand Down
31 changes: 16 additions & 15 deletions src/olmo_core/launch/beaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ class BeakerWekaBucket(Config):
mount: str


DEFAULT_SETUP_STEPS = (
'git clone "${REPO_URL}" .',
'git checkout "${GIT_REF}"',
"git submodule update --init --recursive",
"conda shell.bash activate base",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we do expect conda. If so, can we just define PRIVATE_REPO_SETUP_STEPS, and then it will Just Work ™ ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is just the default because we know conda will be on the default images.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fair enough.

"pip install -e '.[all]'",
"pip freeze",
)


@dataclass
class BeakerLaunchConfig(Config):
"""
Expand Down Expand Up @@ -120,16 +130,10 @@ class BeakerLaunchConfig(Config):
A description for the experiment.
"""

setup_steps: List[str] = field(
default_factory=lambda: [
"conda shell.bash activate base",
"pip install -e '.[all]'",
"pip freeze",
]
)
setup_steps: List[str] = field(default_factory=lambda: list(DEFAULT_SETUP_STEPS))
"""
A list of shell commands to run for installing dependencies, running arbitrary scripts,
and other setup steps.
A list of shell commands to run for cloning your repo, installing dependencies,
and other arbitrary setup steps.
"""

beaker_image: str = OLMoCoreBeakerImage.stable
Expand Down Expand Up @@ -296,20 +300,17 @@ def build_experiment_spec(self, torchrun: bool = True) -> ExperimentSpec:
# Get repository account, name, and current ref.
github_account, github_repo, git_ref, is_public = ensure_repo(self.allow_dirty)

if not is_public:
if not is_public and self.setup_steps == DEFAULT_SETUP_STEPS:
raise OLMoConfigurationError(
"Only public repositories are supported at the moment. "
"Please use beaker-gantry to launch jobs with private repos."
"It looks like your repository is private and private repositories will require "
"custom 'setup_steps' in order to clone the repo."
)

entrypoint_script = [
"#!/usr/bin/env bash",
"set -exuo pipefail",
"mkdir -p /olmo-core-runtime",
"cd /olmo-core-runtime",
'git clone "${REPO_URL}" .',
'git checkout "${GIT_REF}"',
"git submodule update --init --recursive",
*self.setup_steps,
]

Expand Down
Loading