mirror of
https://github.com/Toumash/mlflow-docker
synced 2025-11-04 15:19:21 +01:00
dev commit
This commit is contained in:
24
another/Dockerfile
Normal file
24
another/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM python:3.7.0
|
||||||
|
LABEL maintainer="Albert Franzi"
|
||||||
|
|
||||||
|
ENV MLFLOW_HOME /opt/mlflow
|
||||||
|
ENV SERVER_PORT 5000
|
||||||
|
ENV SERVER_HOST 0.0.0.0
|
||||||
|
ENV FILE_STORE ${MLFLOW_HOME}/fileStore
|
||||||
|
ENV ARTIFACT_STORE ${MLFLOW_HOME}/artifactStore
|
||||||
|
|
||||||
|
RUN pip install mlflow && \
|
||||||
|
mkdir -p ${MLFLOW_HOME}/scripts && \
|
||||||
|
mkdir -p ${FILE_STORE} && \
|
||||||
|
mkdir -p ${ARTIFACT_STORE}
|
||||||
|
|
||||||
|
COPY scripts/run.sh ${MLFLOW_HOME}/scripts/run.sh
|
||||||
|
RUN chmod +x ${MLFLOW_HOME}/scripts/run.sh
|
||||||
|
|
||||||
|
EXPOSE ${SERVER_PORT}/tcp
|
||||||
|
|
||||||
|
VOLUME ["${MLFLOW_HOME}/scripts/", "${FILE_STORE}", "${ARTIFACT_STORE}"]
|
||||||
|
|
||||||
|
WORKDIR ${MLFLOW_HOME}
|
||||||
|
|
||||||
|
ENTRYPOINT ["./scripts/run.sh"]
|
||||||
7
another/scripts/run.sh
Normal file
7
another/scripts/run.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mlflow server \
|
||||||
|
--file-store $FILE_STORE \
|
||||||
|
--default-artifact-root $ARTIFACT_STORE \
|
||||||
|
--host $SERVER_HOST \
|
||||||
|
--port $SERVER_PORT
|
||||||
35
docker-compose.yml
Normal file
35
docker-compose.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
sftp:
|
||||||
|
image: atmoz/sftp
|
||||||
|
#volumes:
|
||||||
|
# - <host-dir>/upload:/home/foo/upload
|
||||||
|
ports:
|
||||||
|
- "2222:22"
|
||||||
|
command: ftpuser:ftppass:::0
|
||||||
|
networks:
|
||||||
|
- A
|
||||||
|
database:
|
||||||
|
container_name: pg_mlflow
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=pgsql
|
||||||
|
- POSTGRES_PASSWORD=pg_password
|
||||||
|
- POSTGRES_DB=mlflow
|
||||||
|
networks:
|
||||||
|
- A
|
||||||
|
tracker:
|
||||||
|
container_name: tracker_mlflow
|
||||||
|
image: tracker_ml
|
||||||
|
build:
|
||||||
|
context: ./mlflow
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
networks:
|
||||||
|
- A
|
||||||
|
|
||||||
|
entrypoint: mlflow server --default-artifact-root sftp://ftpuser:ftppass@localhost:2222 -h 0.0.0.0
|
||||||
|
networks:
|
||||||
|
A:
|
||||||
|
driver: bridge
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
FROM continuumio/miniconda3:latest
|
FROM continuumio/miniconda3:latest
|
||||||
|
|
||||||
MAINTAINER JianKai Wang "https://jiankaiwang.no-ip.biz"
|
|
||||||
|
|
||||||
ADD . /app
|
ADD . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
import os
|
import os
|
||||||
from random import random, randint
|
from random import random, randint
|
||||||
|
|
||||||
from mlflow import log_metric, log_param, log_artifacts
|
from mlflow import mlflow,log_metric, log_param, log_artifacts
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("Running mlflow_tracking.py")
|
with mlflow.start_run() as run:
|
||||||
|
mlflow.set_tracking_uri('http://localhost:5000')
|
||||||
|
print("Running mlflow_tracking.py")
|
||||||
|
|
||||||
log_param("param1", randint(0, 100))
|
log_param("param1", randint(0, 100))
|
||||||
|
|
||||||
log_metric("foo", random())
|
log_metric("foo", random())
|
||||||
log_metric("foo", random() + 1)
|
log_metric("foo", random() + 1)
|
||||||
log_metric("foo", random() + 2)
|
log_metric("foo", random() + 2)
|
||||||
|
|
||||||
if not os.path.exists("outputs"):
|
if not os.path.exists("outputs"):
|
||||||
os.makedirs("outputs")
|
os.makedirs("outputs")
|
||||||
with open("outputs/test.txt", "w") as f:
|
with open("outputs/test.txt", "w") as f:
|
||||||
f.write("hello world!")
|
f.write("hello world!")
|
||||||
|
|
||||||
log_artifacts("outputs")
|
log_artifacts("outputs")
|
||||||
|
|||||||
Reference in New Issue
Block a user