Skip to content

Commit 46b521d

Browse files
authored
Merge pull request #38 from stemann/feature/devcontainer
- Added dev. container - Using `MLFLOW_TRACKING_URI` env variable to define the default URI
2 parents a31b41a + 56479a5 commit 46b521d

File tree

6 files changed

+41
-4
lines changed

6 files changed

+41
-4
lines changed

.devcontainer/compose.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
3+
services:
4+
project:
5+
image: mcr.microsoft.com/devcontainers/base:debian
6+
volumes:
7+
- ../..:/workspaces:cached
8+
command: sleep infinity # Overrides default command so things don't shut down after the process ends.
9+
10+
mlflow:
11+
image: ghcr.io/mlflow/mlflow:v2.10.0
12+
entrypoint: ["mlflow", "server", "--host", "0.0.0.0"]
13+
ports:
14+
- "5000"

.devcontainer/devcontainer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"dockerComposeFile": "compose.yaml",
3+
"service": "project",
4+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
5+
"features": {
6+
"ghcr.io/julialang/devcontainer-features/julia:1": {
7+
"channel": "release"
8+
}
9+
},
10+
"containerEnv": {
11+
"JULIA_PROJECT": "/workspaces/${localWorkspaceFolderBasename}",
12+
"MLFLOW_TRACKING_URI": "http://mlflow:5000",
13+
}
14+
}

.github/workflows/CI.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
${{ runner.os }}-
5050
- uses: julia-actions/julia-buildpkg@v1
5151
- uses: julia-actions/julia-runtest@v1
52+
env:
53+
MLFLOW_TRACKING_URI: "http://localhost:5000"
5254
- uses: julia-actions/julia-processcoverage@v1
5355
- uses: codecov/codecov-action@v2
5456
with:

src/types/mlflow.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Base type which defines location and version for MLFlow API service.
1111
# Constructors
1212
1313
- `MLFlow(baseuri; apiversion=2.0,headers=Dict())`
14-
- `MLFlow()` - defaults to `MLFlow("http://localhost:5000")`
14+
- `MLFlow()` - defaults to `MLFlow(ENV["MLFLOW_TRACKING_URI"])` or `MLFlow("http://localhost:5000")`
1515
1616
# Examples
1717
@@ -31,5 +31,12 @@ struct MLFlow
3131
headers::Dict
3232
end
3333
MLFlow(baseuri; apiversion=2.0,headers=Dict()) = MLFlow(baseuri, apiversion,headers)
34-
MLFlow() = MLFlow("http://localhost:5000", 2.0, Dict())
34+
function MLFlow()
35+
baseuri = "http://localhost:5000"
36+
if haskey(ENV, "MLFLOW_TRACKING_URI")
37+
baseuri = ENV["MLFLOW_TRACKING_URI"]
38+
end
39+
return MLFlow(baseuri)
40+
end
41+
3542
Base.show(io::IO, t::MLFlow) = show(io, ShowCase(t, [:baseuri,:apiversion], new_lines=true))

test/base.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function mlflow_server_is_running(mlf::MLFlow)
1313
end
1414

1515
# creates an instance of mlf
16-
# skips test if mlflow is not available on default location, http://localhost:5000
16+
# skips test if mlflow is not available on default location, ENV["MLFLOW_TRACKING_URI"]
1717
macro ensuremlf()
1818
e = quote
1919
mlf = MLFlow()

test/test_functional.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@testset "MLFlow" begin
22
mlf = MLFlow()
3-
@test mlf.baseuri == "http://localhost:5000"
3+
@test mlf.baseuri == ENV["MLFLOW_TRACKING_URI"]
44
@test mlf.apiversion == 2.0
55
@test mlf.headers == Dict()
66
mlf = MLFlow("https://localhost:5001", apiversion=3.0)

0 commit comments

Comments
 (0)