-
Notifications
You must be signed in to change notification settings - Fork 10
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 #37 from pebeto/improving_code_base
Improving code base
- Loading branch information
Showing
13 changed files
with
139 additions
and
101 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,2 @@ | ||
ignore: | ||
- "src/deprecated.jl" |
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
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,34 @@ | ||
""" | ||
mlfget(mlf, endpoint; kwargs...) | ||
Performs a HTTP GET to a specified endpoint. kwargs are turned into GET params. | ||
""" | ||
function mlfget(mlf, endpoint; kwargs...) | ||
apiuri = uri(mlf, endpoint, kwargs) | ||
apiheaders = headers(mlf, Dict("Content-Type" => "application/json")) | ||
|
||
try | ||
response = HTTP.get(apiuri, apiheaders) | ||
return JSON.parse(String(response.body)) | ||
catch e | ||
throw(e) | ||
end | ||
end | ||
|
||
""" | ||
mlfpost(mlf, endpoint; kwargs...) | ||
Performs a HTTP POST to the specified endpoint. kwargs are converted to JSON and become the POST body. | ||
""" | ||
function mlfpost(mlf, endpoint; kwargs...) | ||
apiuri = uri(mlf, endpoint) | ||
apiheaders = headers(mlf, Dict("Content-Type" => "application/json")) | ||
body = JSON.json(kwargs) | ||
|
||
try | ||
response = HTTP.post(apiuri, apiheaders, body) | ||
return JSON.parse(String(response.body)) | ||
catch e | ||
throw(e) | ||
end | ||
end |
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
File renamed without changes.
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,35 @@ | ||
""" | ||
MLFlow | ||
Base type which defines location and version for MLFlow API service. | ||
# Fields | ||
- `baseuri::String`: base MLFlow tracking URI, e.g. `http://localhost:5000` | ||
- `apiversion`: used API version, e.g. `2.0` | ||
- `headers`: HTTP headers to be provided with the REST API requests (useful for authetication tokens) | ||
# Constructors | ||
- `MLFlow(baseuri; apiversion=2.0,headers=Dict())` | ||
- `MLFlow()` - defaults to `MLFlow("http://localhost:5000")` | ||
# Examples | ||
```@example | ||
mlf = MLFlow() | ||
``` | ||
```@example | ||
remote_url="https://<your-server>.cloud.databricks.com"; # address of your remote server | ||
mlf = MLFlow(remote_url, headers=Dict("Authorization" => "Bearer <your-secret-token>")) | ||
``` | ||
""" | ||
struct MLFlow | ||
baseuri::String | ||
apiversion::Union{Integer, AbstractFloat} | ||
headers::Dict | ||
end | ||
MLFlow(baseuri; apiversion=2.0,headers=Dict()) = MLFlow(baseuri, apiversion,headers) | ||
MLFlow() = MLFlow("http://localhost:5000", 2.0, Dict()) | ||
Base.show(io::IO, t::MLFlow) = show(io, ShowCase(t, [:baseuri,:apiversion], new_lines=true)) |
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
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