Skip to content

Commit

Permalink
update make script and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel committed Sep 18, 2019
1 parent 1ea0f91 commit e58d3eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# High-Throughput Computing Notebooks

This repository contains the source Dockerfiles for
CHTC's High-Throughput Computing Notebooks (HTC Notebook).
Each notebook is based on one of the [Jupyter Docker Stacks](https://github.com/jupyter/docker-stacks),
CHTC's High-Throughput Computing Notebooks (HTC Notebooks).
Each notebook is based on one of the
[Jupyter Docker Stacks](https://github.com/jupyter/docker-stacks),
as specified by their names.

A HTC Notebook contains both a Jupyter Lab and a "personal" HTCondor that can run jobs locally.
It can also be configured as (for example) part of a Jupyter Hub which connects users to a larger HTCondor pool.
A HTC Notebook contains both a Jupyter Lab and a "personal" HTCondor that can
run jobs locally.
It can also be configured as part of a Jupyter Hub which connects
users to a larger HTCondor pool.

## Quick Start

Expand All @@ -20,4 +23,4 @@ Replace `htc-scipy-notebook` with your preferred stack,
and `latest` with your preferred tag.

The `latest` tag will always point at the most recent version of that stack,
but SHA-tagged previous version are available as well.
but date-tagged previous version are available as well.
37 changes: 25 additions & 12 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,33 @@
NOTEBOOKS_DIR = ROOT / 'notebooks'
TEMPLATE_DIR = ROOT / 'template'

shutil.rmtree(NOTEBOOKS_DIR, ignore_errors = True)
NOTEBOOKS_DIR.mkdir()
# get the base Dockerfile text
DF_TEMPLATE = (TEMPLATE_DIR / 'Dockerfile').read_text()

(NOTEBOOKS_DIR / 'DO_NOT_MODIFY').write_text('DO NOT MODIFY ANYTHING IN THIS DIRECTORY\nIT IS GENERATED BY make.py\n')

for base_image in (ROOT / 'BASE_IMAGES.txt').read_text().splitlines():
repo, image, tag = re.match(r'(.*)\/(.*):(.*)', base_image).groups()
def main():
shutil.rmtree(NOTEBOOKS_DIR, ignore_errors = True)
NOTEBOOKS_DIR.mkdir()

our_image = 'htc-{}'.format(image)
(NOTEBOOKS_DIR / 'DO_NOT_MODIFY').write_text(
'DO NOT MODIFY ANYTHING IN THIS DIRECTORY\nIT IS GENERATED BY make.py\n'
)

image_dir = NOTEBOOKS_DIR / our_image
shutil.copytree(TEMPLATE_DIR, image_dir, ignore = lambda *_: ['Dockerfile'])
for base_image in (ROOT / 'BASE_IMAGES.txt').read_text().splitlines():
repo, image, tag = re.match(r'(.*)\/(.*):(.*)', base_image).groups()

df = image_dir / 'Dockerfile'
df_template = (TEMPLATE_DIR / 'Dockerfile').read_text()
df_text = df_template.replace('<BASE_IMAGE>', base_image)
df.write_text(df_text)
our_image = 'htc-{}'.format(image)

image_dir = NOTEBOOKS_DIR / our_image

# copy everything but the Dockerfile, which will be done in the next step
shutil.copytree(TEMPLATE_DIR, image_dir, ignore = lambda *_: ['Dockerfile'])

# write out the the modified Dockerfile for this image
df = image_dir / 'Dockerfile'
df_text = DF_TEMPLATE.replace('<BASE_IMAGE>', base_image)
df.write_text(df_text)


if __name__ == '__main__':
main()

0 comments on commit e58d3eb

Please sign in to comment.