Project

General

Profile

ML beam test PID Meetings » History » Version 22

Richard Trotta, 05/29/2024 12:32 PM

1 1 Richard Trotta
{{>toc}}
2
3
h1. ML beam test PID Meetings
4
5 3 Richard Trotta
---
6
7 1 Richard Trotta
h2. Summer 2024
8 4 Richard Trotta
9
---
10
11 2 Richard Trotta
h3. May 27th, 2024
12 1 Richard Trotta
13
* Darren ran with Python3.9
14
* Docker (containerization) Definition
15
** Containerization is a technology that allows developers to package and run applications along with all their dependencies in isolated environments called containers. This ensures that the application runs consistently across different computing environments, from a developer's laptop to testing, staging, and production.
16
** Docker is a popular platform that simplifies containerization. It provides tools to create, deploy, and manage containers. With Docker, developers can write code locally, share their work with colleagues, and deploy to production in a seamless and efficient manner. Docker containers are lightweight, fast, and portable, making them ideal for modern software development and deployment.
17 9 Richard Trotta
18 17 Richard Trotta
* "A Crash Course for Summer Research":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing\
19
* "GitHub and Python Introduction":https://github.com/trottar/UVA_summer_students
20 18 Richard Trotta
** Navigate to "python_tutorials":https://github.com/trottar/UVA_summer_students/tree/master/python_tutorials and read through the two html files ("Introduction":https://github.com/trottar/UVA_summer_students/blob/master/python_tutorials/Introduction.ipynb and "python_tutorial_2":https://github.com/trottar/UVA_summer_students/blob/master/python_tutorials/python_tutorial_2.ipynb)
21
*** Note, these are html files so you'll need 
22 8 Richard Trotta
23
h4. Near-term Goals
24
25
# Setup Linux Subsystem for Windows
26
# Fork the ML Beam Testing GitHub repository
27
# Containerize ML Beam Testing GitHub repository with Docker
28 5 Richard Trotta
29 14 Richard Trotta
h4. Homework
30
31 16 Richard Trotta
* "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing
32 14 Richard Trotta
33 3 Richard Trotta
---
34 19 Richard Trotta
35
h3. May 27th, 2024
36
37
h4. Setting Up Jupyter Notebooks in Docker
38
39
# Create a directory to store, build, and run Docker container
40
	<pre><code class="bash">
41
cd /path/to/directory
42
mkdir beamtest_dir
43 20 Richard Trotta
cd beamtest_dir
44
</code></pre>
45 21 Richard Trotta
# Once in the new directory, create a Dockerfile
46 20 Richard Trotta
	<pre><code class="bash">
47
touch Dockerfile
48
</code></pre>
49 21 Richard Trotta
# Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information
50 20 Richard Trotta
	<pre><code class="bash">
51
# Use the official Python 3.9 image as the base image
52
FROM python:3.9
53
54
# Install Jupyter Notebook and other dependencies
55
RUN pip install --no-cache-dir jupyter
56
57
# Create a working directory
58
WORKDIR /workspace
59
60
# Expose the Jupyter Notebook port
61
EXPOSE 8888
62
63
# Set the default command to start Jupyter Notebook
64 1 Richard Trotta
CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
65
</code></pre>
66 21 Richard Trotta
# Build the Docker image (e.g., helloworld)
67
	<pre><code class="bash">
68
docker build -t helloworld .
69
</code></pre>
70
# Run the Docker container
71
</code></pre>
72
# Build the Docker image (e.g., helloworld)
73
	<pre><code class="bash">
74
docker run -p 8888:8888 helloworld
75
</code></pre>
76
# Jupyter Notebook is now running. Navigate to a browser and type in either
77
* The custom token authorization screen</code></pre>
78
# Build the Docker image (e.g., helloworld)
79
	<pre><code class="bash">
80
http://localhost:8888
81
</code></pre>
82 22 Richard Trotta
83 21 Richard Trotta
* To bypass the token screen, copy/paste the URL that splashes in the terminal into your browser