Exporting an environment
See original GitHub issueIs it worth adding a couple of util scripts that would export the users current environment (conda or virtual env) and builds a docker image on top of daskdev/dask:latest
?
Being able to pass a list of conda/pip packages is fine for relatively simple environments / prototyping but I can see value in something slightly more stable. Building a new image (Shouldn’t need to be done too often) will increase the connection time to the KubeCluster, but will reduce the worker start up time.
I have some basic POC of this, which I am currently using, which looks something like
- On Jupyterlab, build my conda env / validate locally in notebook
- Export the environment
- Build a docker image on top of
daskdev/dask:latest
, using something like
dockerfile_template = (
'FROM daskdev/dask:latest\n'
'ADD {environment_file} /opt/app/environment.yml\n'
'RUN /opt/conda/bin/conda env update -n dask -f /opt/app/environment.yml && \ \n'
' conda clean -tipsy'
)
def build_publish_dockerfile(context_dir, dockerfile_txt, tag):
with pathlib.Path(os.getcwd()).joinpath('dockerfile').open('w') as f:
f.write(dockerfile_txt)
client.images.build(
path='.', dockerfile='dockerfile', tag='%s/%s' % (DOCKER_HUB_REPO, tag), nocache=True
)
def image_from_conda_env(env_name, tag, conda_bin='conda'):
with tempfile.TemporaryDirectory() as tmp_dir:
env_file = pathlib.Path(tmp_dir).joinpath('environment.yml')
export_conda_env(env_name, env_file, conda_bin)
dockerfile = dockerfile_template.format(env_file)
build_publish_dockerfile(tmp_dir, dockerfile_txt=dockerfile, tag=tag)
image_from_conda_env('myenv', 'dask-worker-myenv')
k = KubeCluster(image='dask-worker-myenv')
Is this in the works? Or any thoughts on the above?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Managing environments - Conda
With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them.
Read more >How to Export and Load Anaconda Environments for Data ...
There's a way around it. You can use Anaconda to export a Python virtual environment to a YAML file you can then reuse...
Read more >How to Export and Load Anaconda Environments for Data ...
Did you know you can export and share Anaconda environments? It boils down to a single Terminal command - here's how to get...
Read more >Exporting an Environment - Python How Tos
Exporting an Environment · Ensure that the repository on your local machine matches the repository in GitHub. · With the proper environment activated...
Read more >Exporting environment variables - IBM
You can export environment variables to a file (*.env) from the Projects page in the IBM® InfoSphere® DataStage® and QualityStage® Administrator client.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jcrist 's conda-pack might also be of interest.
Ideally for the workers we can even drop conda and just distribute a zip of an environment.
Lets keep it open for now if that’s alright. This is a valuable goal to keep in mind.