-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from UCSD-E4E/github
feat: add docker CLI for building docker containers
- Loading branch information
Showing
8 changed files
with
82 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build prod and push | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
tags: ghcr.io/ucsd-e4e/maestro_trainer:main | ||
push: true | ||
cache-from: type=registry,ref=ghcr.io/ucsd-e4e/maestro_trainer:main_cache | ||
cache-to: type=registry,ref=ghcr.io/ucsd-e4e/maestro_trainer:main_cache,mode=max | ||
- | ||
name: Build prod and push | ||
if: github.ref != 'refs/heads/main' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
tags: ghcr.io/ucsd-e4e/maestro_trainer:${{ github.head_ref }} | ||
push: true | ||
cache-from: type=registry,ref=ghcr.io/ucsd-e4e/maestro_trainer:${{ github.head_ref }}_cache | ||
cache-to: type=registry,ref=ghcr.io/ucsd-e4e/maestro_trainer:${{ github.head_ref }}_cache,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# model_trainer | ||
|
||
An example trainer for maestro active learning system |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
|
||
import os | ||
import socketio | ||
import time | ||
from model import Trainer | ||
# import socketio | ||
# import time | ||
# from model import Trainer | ||
|
||
print(os.environ) | ||
print("RUNNING PYTHON!!!", flush=True) | ||
|
||
|
||
|
||
|
||
pod_name = os.environ['pod-name'] | ||
sio = socketio.Client() | ||
# pod_name = os.environ['pod-name'] | ||
# sio = socketio.Client() | ||
|
||
@sio.event | ||
def connect(): | ||
print('connection established', flush=True) | ||
sio.emit('job_ready', {'pod-name': pod_name}) | ||
# @sio.event | ||
# def connect(): | ||
# print('connection established', flush=True) | ||
# sio.emit('job_ready', {'pod-name': pod_name}) | ||
|
||
@sio.on('start_job') | ||
def trigger_test(data): | ||
print("importing in model") | ||
start = time.time() | ||
print(data, flush=True) | ||
# Expect batch to be a list of directory of file and label | ||
batch = data["batch"] | ||
cfg = data["cfg"] | ||
trainer = Trainer(cfg, batch) | ||
trainer.build() | ||
loss = trainer.train() | ||
# @sio.on('start_job') | ||
# def trigger_test(data): | ||
# print("importing in model") | ||
# start = time.time() | ||
# print(data, flush=True) | ||
# # Expect batch to be a list of directory of file and label | ||
# batch = data["batch"] | ||
# cfg = data["cfg"] | ||
# trainer = Trainer(cfg, batch) | ||
# trainer.build() | ||
# loss = trainer.train() | ||
|
||
end = time.time() | ||
print("Job Done", loss, "time", end - start, flush=True) | ||
sio.emit('job_done', {'loss': loss, "pod-name": pod_name}, callback=sio.disconnect) | ||
# end = time.time() | ||
# print("Job Done", loss, "time", end - start, flush=True) | ||
# sio.emit('job_done', {'loss': loss, "pod-name": pod_name}, callback=sio.disconnect) | ||
|
||
@sio.event | ||
def my_message(data): | ||
print('message received with ', data, flush=True) | ||
sio.emit('my response', {'response': 'my response'}) | ||
# @sio.event | ||
# def my_message(data): | ||
# print('message received with ', data, flush=True) | ||
# sio.emit('my response', {'response': 'my response'}) | ||
|
||
@sio.event | ||
def disconnect(): | ||
print('disconnected from server', flush=True) | ||
# @sio.event | ||
# def disconnect(): | ||
# print('disconnected from server', flush=True) | ||
|
||
sio.connect('https://test-service2.nrp-nautilus.io') | ||
sio.wait() | ||
# sio.connect('https://test-service2.nrp-nautilus.io') | ||
# sio.wait() | ||
|
||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.