Skip to content

torchx/runner,cli: add patching support via WorkspaceScheduler #360

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

Closed
wants to merge 1 commit into from

Conversation

d4l3k
Copy link
Member

@d4l3k d4l3k commented Dec 11, 2021

This adds patching support to the cli and runner.

To keep this somewhat isolated from the main APIs there's now a couple of new concepts:

  • WorkspaceScheduler extends Scheduler and adds a build_workspace_image
  • WorkspaceRunner extends Runner and adds support for building a workspace image as part of dryrun

This makes the cli run command use the WorkspaceRunner instead of the normal Runner for experimentation purposes.

Patching is enabled if the cwd contains a .torchxconfig file.

Test plan:

$ touch .torchxconfig
$ echo "echo foo" > foo.sh
$ torchx run --scheduler local_docker utils.sh sh foo.sh
torchx 2021-12-10 16:24:19 INFO     loaded configs from /home/tristanr/Developer/torchx-proj/.torchxconfig
torchx 2021-12-10 16:24:19 INFO     building patch images for workspace: file:///home/tristanr/Developer/torchx-proj...
torchx 2021-12-10 16:24:21 INFO     Pulling container image: sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be (this may take a while)
torchx 2021-12-10 16:24:23 WARNING  failed to pull image sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be, falling back to local: 404 Client Error for htt
p+docker://localhost/v1.41/images/create?tag=0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be&fromImage=sha256: Not Found ("pull access denied for sha256, reposi
tory does not exist or may require 'docker login': denied: requested access to the resource is denied")
local_docker://torchx/sh-g7frzl4q92g2bd
torchx 2021-12-10 16:24:24 INFO     Waiting for the app to finish...
torchx 2021-12-10 16:24:24 INFO     Job finished: SUCCEEDED
sh/0 foo

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 11, 2021
@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #360 (fe34bba) into main (310398c) will increase coverage by 0.00%.
The diff coverage is 95.71%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #360   +/-   ##
=======================================
  Coverage   94.61%   94.62%           
=======================================
  Files          60       61    +1     
  Lines        3103     3160   +57     
=======================================
+ Hits         2936     2990   +54     
- Misses        167      170    +3     
Impacted Files Coverage Δ
torchx/schedulers/api.py 90.14% <75.00%> (-0.91%) ⬇️
torchx/cli/cmd_run.py 89.51% <83.33%> (-1.09%) ⬇️
torchx/runner/config.py 100.00% <100.00%> (ø)
torchx/runner/workspaces.py 100.00% <100.00%> (ø)
torchx/schedulers/docker_scheduler.py 97.20% <100.00%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 310398c...fe34bba. Read the comment docs.

@d4l3k d4l3k force-pushed the cli_workspace branch 2 times, most recently from 3c41b4e to d4b8890 Compare December 11, 2021 00:52
@facebook-github-bot
Copy link
Contributor

@d4l3k has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@d4l3k has updated the pull request. You must reimport the pull request before landing.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@d4l3k has updated the pull request. You must reimport the pull request before landing.

d4l3k added a commit that referenced this pull request Jan 4, 2022
Summary:
This adds patching support to the cli and runner.

To keep this somewhat isolated from the main APIs there's now a couple of new concepts:
* WorkspaceScheduler extends Scheduler and adds a build_workspace_image
* WorkspaceRunner extends Runner and adds support for building a workspace image as part of dryrun

This makes the cli run command use the WorkspaceRunner instead of the normal Runner for experimentation purposes.

Patching is enabled if the cwd contains a .torchxconfig file.

Pull Request resolved: #360

Test Plan:
$ touch .torchxconfig
$ echo "echo foo" > foo.sh
$ torchx run --scheduler local_docker utils.sh sh foo.sh
torchx 2021-12-10 16:24:19 INFO     loaded configs from /home/tristanr/Developer/torchx-proj/.torchxconfig
torchx 2021-12-10 16:24:19 INFO     building patch images for workspace: file:///home/tristanr/Developer/torchx-proj...
torchx 2021-12-10 16:24:21 INFO     Pulling container image: sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be (this may take a while)
torchx 2021-12-10 16:24:23 WARNING  failed to pull image sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be, falling back to local: 404 Client Error for htt
p+docker://localhost/v1.41/images/create?tag=0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be&fromImage=sha256: Not Found ("pull access denied for sha256, reposi
tory does not exist or may require 'docker login': denied: requested access to the resource is denied")
local_docker://torchx/sh-g7frzl4q92g2bd
torchx 2021-12-10 16:24:24 INFO     Waiting for the app to finish...
torchx 2021-12-10 16:24:24 INFO     Job finished: SUCCEEDED
sh/0 foo

Reviewed By: kiukchung

Differential Revision: D33036468

Pulled By: d4l3k

fbshipit-source-id: 790ee5fc784adc0c5a3826b63aed5eb6f4e0817e
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33036468

Summary:
This adds patching support to the cli and runner.

To keep this somewhat isolated from the main APIs there's now a couple of new concepts:
* WorkspaceScheduler extends Scheduler and adds a build_workspace_image
* WorkspaceRunner extends Runner and adds support for building a workspace image as part of dryrun

This makes the cli run command use the WorkspaceRunner instead of the normal Runner for experimentation purposes.

Patching is enabled if the cwd contains a .torchxconfig file.

Pull Request resolved: #360

Test Plan:
$ touch .torchxconfig
$ echo "echo foo" > foo.sh
$ torchx run --scheduler local_docker utils.sh sh foo.sh
torchx 2021-12-10 16:24:19 INFO     loaded configs from /home/tristanr/Developer/torchx-proj/.torchxconfig
torchx 2021-12-10 16:24:19 INFO     building patch images for workspace: file:///home/tristanr/Developer/torchx-proj...
torchx 2021-12-10 16:24:21 INFO     Pulling container image: sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be (this may take a while)
torchx 2021-12-10 16:24:23 WARNING  failed to pull image sha256:0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be, falling back to local: 404 Client Error for htt
p+docker://localhost/v1.41/images/create?tag=0da419b5accdba18412014ffeafcf782acd53d6522a198ee7cbfb48556f355be&fromImage=sha256: Not Found ("pull access denied for sha256, reposi
tory does not exist or may require 'docker login': denied: requested access to the resource is denied")
local_docker://torchx/sh-g7frzl4q92g2bd
torchx 2021-12-10 16:24:24 INFO     Waiting for the app to finish...
torchx 2021-12-10 16:24:24 INFO     Job finished: SUCCEEDED
sh/0 foo

Reviewed By: kiukchung

Differential Revision: D33036468

Pulled By: d4l3k

fbshipit-source-id: 430f1955ce77ff3a3b1d9b1a5ba5deaebf4f25c2
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D33036468

@d4l3k d4l3k deleted the cli_workspace branch February 1, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants