Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dev. container #38

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'

services:
project:
image: mcr.microsoft.com/devcontainers/base:debian
volumes:
- ../..:/workspaces:cached
command: sleep infinity # Overrides default command so things don't shut down after the process ends.

mlflow:
image: ghcr.io/mlflow/mlflow:v2.10.0
entrypoint: ["mlflow", "server", "--host", "0.0.0.0"]
ports:
- "5000"
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"dockerComposeFile": "compose.yaml",
"service": "project",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/julialang/devcontainer-features/julia:1": {
"channel": "release"
}
},
"containerEnv": {
"JULIA_PROJECT": "/workspaces/${localWorkspaceFolderBasename}",
"MLFLOW_TRACKING_URI": "http://mlflow:5000",
}
}
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
MLFLOW_TRACKING_URI: "http://localhost:5000"
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
Expand Down
11 changes: 9 additions & 2 deletions src/types/mlflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Base type which defines location and version for MLFlow API service.
# Constructors

- `MLFlow(baseuri; apiversion=2.0,headers=Dict())`
- `MLFlow()` - defaults to `MLFlow("http://localhost:5000")`
- `MLFlow()` - defaults to `MLFlow(ENV["MLFLOW_TRACKING_URI"])` or `MLFlow("http://localhost:5000")`

# Examples

Expand All @@ -31,5 +31,12 @@ struct MLFlow
headers::Dict
end
MLFlow(baseuri; apiversion=2.0,headers=Dict()) = MLFlow(baseuri, apiversion,headers)
MLFlow() = MLFlow("http://localhost:5000", 2.0, Dict())
function MLFlow()
baseuri = "http://localhost:5000"
if haskey(ENV, "MLFLOW_TRACKING_URI")
baseuri = ENV["MLFLOW_TRACKING_URI"]
end
return MLFlow(baseuri)
end

Base.show(io::IO, t::MLFlow) = show(io, ShowCase(t, [:baseuri,:apiversion], new_lines=true))
2 changes: 1 addition & 1 deletion test/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function mlflow_server_is_running(mlf::MLFlow)
end

# creates an instance of mlf
# skips test if mlflow is not available on default location, http://localhost:5000
# skips test if mlflow is not available on default location, ENV["MLFLOW_TRACKING_URI"]
macro ensuremlf()
e = quote
mlf = MLFlow()
Expand Down
2 changes: 1 addition & 1 deletion test/test_functional.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "MLFlow" begin
mlf = MLFlow()
@test mlf.baseuri == "http://localhost:5000"
@test mlf.baseuri == ENV["MLFLOW_TRACKING_URI"]
@test mlf.apiversion == 2.0
@test mlf.headers == Dict()
mlf = MLFlow("https://localhost:5001", apiversion=3.0)
Expand Down
Loading