Project

General

Profile

ML beam test PID Meetings » History » Revision 30

Revision 29 (Richard Trotta, 05/30/2024 12:04 PM) → Revision 30/73 (Richard Trotta, 05/30/2024 12:05 PM)

{{>toc}} 

 h1. ML beam test PID Meetings 

 --- 

 h2. Summer 2024 

 --- 

 h3. May 28th, 2024 

 * Darren ran with Python3.9 
 * Docker (containerization) Definition 
 ** 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. 
 ** 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. 

 * "A Crash Course for Summer Research":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing\ 
 * "GitHub and Python Introduction":https://github.com/trottar/UVA_summer_students 
 ** 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) 
 *** Note, these are html files so you'll need  

 h4. Near-term Goals 

 # Setup Linux Subsystem for Windows 
 # Fork the ML Beam Testing GitHub repository 
 # Containerize ML Beam Testing GitHub repository with Docker 

 h4. Homework 

 * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing 

 --- 

 h3. May 29th, 2024 

 h4. Setting Up Jupyter Notebooks in Docker 

 # Create a directory to store, build, and run Docker container 
	 <pre><code class="bash"> 
 cd /path/to/directory 
 mkdir beamtest_dir 
 cd beamtest_dir 
 </code></pre> 
 # Once in the new directory, create a Dockerfile 
	 <pre><code class="bash"> 
 touch Dockerfile 
 </code></pre> 
 # Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit the Dockerfile with the following information 
	 <pre><code class="bash"> 
 # Use the official Python 3.9 image as the base image 
 FROM python:3.9 

 # Install Jupyter Notebook and other dependencies 
 RUN pip install --no-cache-dir jupyter 

 # Create a working directory 
 WORKDIR /workspace 

 # Expose the Jupyter Notebook port 
 EXPOSE 8888 

 # Set the default command to start Jupyter Notebook 
 CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] 
 </code></pre> 
 # Build the Docker image (e.g., helloworld) 
	 <pre><code class="bash"> 
 docker build -t helloworld . 
 </code></pre> 
 # Run the Docker container 
 </code></pre> 
	 <pre><code class="bash"> 
 docker run -p 8888:8888 helloworld 
 </code></pre> 
 # Jupyter Notebook is now running. Navigate to a browser and type in either 

 * The custom token authorization screen</code></pre> 
	 <pre><code class="bash"> 
 http://localhost:8888 
 </code></pre> 

 * To bypass the token screen, copy/paste the URL that splashes in the terminal into your browser 

 h4. Near-term Goals 

 # Try and get the "python tutorial":https://github.com/trottar/UVA_summer_students Jupyter notebooks working in a container. 

 h4. Homework 

 * "Read chapters 0-3 and finish exercises":https://drive.google.com/file/d/1-TPLo5VGSwCUDjqj_j4g--p4FbBgYHbw/view?usp=sharing 

 --- 

 

 h3. May 30th, 2024 

 h4. Setting Up Bash Script for Running Docker 

 # Create a bash script 
	 <pre><code class="bash"> 
 touch run_docker.sh 
 </code></pre> 
 # Using the text editor (e.g., vim, gedit, or emacs) of your choice, edit run_docker.sh 
	 <pre><code class="bash"> 
 #!/bin/bash 

 # Build docker image ($1 is the first bash script argument) 
 docker build -t $1 

 # Run the docker container (renaming it with the '_container' string) 
 docker run -p 8888:8888 --name "${1}_container" $1 
 </code></pre> 
 

 # Adjust permissions with "chmod":https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/how-permissions-chmod-with-numbers-command-explained-777-rwx-unix to allow script execution 
	 <pre><code class="bash"> 
 chmod 755 run_docker.sh 
 </code></pre> 

 h4. Setting Up Bash Script for Running Docker 

 h4. Useful Docker Commands 

 * To see all docker images 
	 <pre><code class="bash"> 
 docker images 
 </code></pre> 
 * To see all docker containers running 
	 <pre><code class="bash"> 
 docker ps 
 </code></pre> 
 * To end specific docker container 
	 <pre><code class="bash"> 
 docker end <container_id> 
 </code></pre> 
 * To end all docker container 
	 <pre><code class="bash"> 
 docker end $(docker ps -q) 
 </code></pre>