Skip to content

Commit

Permalink
Clean up for publication:
Browse files Browse the repository at this point in the history
* Include just the SkyPilot Python API variant
* Delete consts module.
  • Loading branch information
mjkanji committed Mar 6, 2024
1 parent 807be59 commit f8091d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
44 changes: 2 additions & 42 deletions dagster_skypilot/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,14 @@ def teardown_all_clusters(logger):
clusters = sky.status(refresh=True)

for c in clusters:
logger.info(f"Shutting down {c['name']}.")
logger.info(f"Shutting down cluster: {c['name']}.")
sky.down(c["name"])

logger.info("All clusters shut down.")


@asset(group_name="ai")
def skypilot_yaml(context: AssetExecutionContext) -> None:
# SkyPilot doesn't support reading credentials from environment variables.
# So, we need to populate the required keyfiles.
populate_keyfiles()

skypilot_bucket = os.getenv("SKYPILOT_BUCKET")

try:
execute_shell_command(
"sky launch -c gemma finetune.yaml --env HF_TOKEN --env DAGSTER_RUN_ID --yes", # -i 5 --down",
output_logging="STREAM",
log=context.log,
cwd=str(UPath(__file__).parent),
# Disable color and styling for rich
env={
**os.environ,
"TERM": "dumb",
"NO_COLOR": "1",
"HF_TOKEN": os.getenv("HF_TOKEN", ""),
"DAGSTER_RUN_ID": context.run_id,
},
)

context.add_output_metadata(get_metrics(context, skypilot_bucket))
finally:
execute_shell_command(
"sky down --all --yes", # -i 5 --down",
output_logging="STREAM",
log=context.log,
cwd=str(UPath(__file__).parent),
# Disable color and styling for rich
env={
**os.environ,
"TERM": "dumb",
"NO_COLOR": "1",
},
)


@asset(group_name="ai")
def skypilot_python_api(context: AssetExecutionContext) -> None:
def skypilot_model(context: AssetExecutionContext) -> None:
# SkyPilot doesn't support reading credentials from environment variables.
# So, we need to populate the required keyfiles.
populate_keyfiles()
Expand Down
3 changes: 0 additions & 3 deletions dagster_skypilot/consts.py

This file was deleted.

0 comments on commit f8091d3

Please sign in to comment.