-
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.
- Loading branch information
Showing
4 changed files
with
175 additions
and
87 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
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 +1,81 @@ | ||
include("types/modelselection_job.jl") | ||
using Dates | ||
using ModelSelection: | ||
Preprocessing, AllSubsetRegression, CrossValidation, ModelSelectionData | ||
|
||
""" | ||
ModelSelectionJob | ||
A mutable struct that represents a job for performing model selection. | ||
# Fields | ||
- `id::String`: The unique identifier (UUID) of the model selection job. | ||
- `filename::String`: The name of the file used for model selection. | ||
- `tempfile::String`: The name of a temporary file used during the job's processing. | ||
- `filehash::String`: The unique identifier (UUID) of the file used for model selection. | ||
- `estimator::Symbol`: The estimator used for model selection. | ||
- `equation::String`: The equation or formula used for model selection. | ||
- `parameters::Dict{Symbol,Any}`: The parameters used for model selection, including any additional parameters specified in the request. | ||
- `status::Symbol`: The status of the model selection job (`"pending"`, `"running"`, `"finished"`, or `"failed"`). | ||
- `time_enqueued::DateTime`: The timestamp when the model selection job was enqueued. | ||
- `time_started::Union{DateTime, Nothing}`: The timestamp when the model selection job started, if applicable. | ||
- `time_finished::Union{DateTime, Nothing}`: The timestamp when the model selection job finished, if applicable. | ||
- `modelselection_data::Union{ModelSelectionData, Nothing}`: The data used for model selection. This is `Nothing` if the data is not available. | ||
- `msg::Union{String, Nothing}`: A message associated with the job. This is typically used for reporting errors or other important information. | ||
# Example | ||
```julia | ||
result = ModelSelectionJob( | ||
filename = "data.csv", | ||
tempfile = "/tmp/12413947-1597-4b1b-a798-efcb2293e808.csv", | ||
filehash = "12413947-95bc-4573-a804-efcb2293e808", | ||
payload = { | ||
:estimator: :ols, | ||
:equation: "y x1 x2 x3", | ||
"ttest": true, | ||
}, | ||
) | ||
``` | ||
""" | ||
mutable struct ModelSelectionJob | ||
id::String | ||
filename::String | ||
tempfile::String | ||
filehash::String | ||
estimator::Symbol | ||
equation::String | ||
parameters::Dict{Symbol,Any} | ||
status::Symbol | ||
time_enqueued::DateTime | ||
time_started::Union{DateTime,Nothing} | ||
time_finished::Union{DateTime,Nothing} | ||
modelselection_data::Union{ModelSelectionData,Nothing} | ||
msg::Union{String,Nothing} | ||
|
||
function ModelSelectionJob( | ||
filename::String, | ||
tempfile::String, | ||
filehash::String, | ||
estimator::Symbol, | ||
equation::String, | ||
parameters::Dict, | ||
) | ||
id = string(uuid4()) | ||
time_enqueued = now() | ||
parameters = Dict{Symbol,Any}(parameters) | ||
new( | ||
id, | ||
filename, | ||
tempfile, | ||
filehash, | ||
estimator, | ||
equation, | ||
parameters, | ||
PENDING, | ||
time_enqueued, | ||
nothing, | ||
nothing, | ||
nothing, | ||
nothing, | ||
) | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
@safetestset "Test const" begin | ||
using ModelSelectionGUI | ||
|
||
MODEL_SELECTION_NAME = "ModelSelection" | ||
MODEL_SELECTION_VER = get_pkg_version(MODEL_SELECTION_NAME) | ||
ENV_FILE_DEFAULT = ".env" | ||
SERVER_HOST_DEFAULT = "127.0.0.1" | ||
SERVER_PORT_DEFAULT = 8000 | ||
SSL_ENABLED_DEFAULT = false | ||
OPEN_DOCUMENTATION_DEFAULT = false | ||
OPEN_CLIENT_DEFAULT = false | ||
DATA = :data | ||
FILEHASH = :filehash | ||
FILENAME = :filename | ||
ID = :id | ||
MESSAGE = :message | ||
PARAMETERS = :parameters | ||
TEMP_FILENAME = :temp_filename | ||
NCORES = :ncores | ||
NWORKERS = :nworkers | ||
MODEL_SELECTION_VERSION = :model_selection_version | ||
JULIA_VERSION = :julia_version | ||
JOBS_QUEUE_SIZE = :jobs_queue_size | ||
STATUS = :status | ||
JOB_ID = :job_id | ||
ENQUEUED = :enqueued | ||
RUNNING = :running | ||
FINISHED = :finished | ||
FAILED = :failed | ||
PENDING = :pending | ||
ESTIMATOR = :estimator | ||
EQUATION = :equation | ||
DATANAMES = :datanames | ||
NOBS = :nobs | ||
TIME_ENQUEUED = :time_enqueued | ||
TIME_STARTED = :time_started | ||
TIME_FINISHED = :time_finished | ||
MSG = :msg | ||
ALLSUBSETREGRESSION = :allsubsetregression | ||
CROSSVALIDATION = :crossvalidation | ||
SUMMARY = :summary | ||
AVAILABLE_RESULTS_TYPES = [ALLSUBSETREGRESSION, CROSSVALIDATION, SUMMARY] | ||
DEFAULT_WS_CHANNEL = :sync | ||
RESULTS = :results | ||
CSV_MIME = "text/csv" | ||
PLAIN_MIME = "text/plain" | ||
|
||
@test ModelSelectionGUI.MODEL_SELECTION_NAME == MODEL_SELECTION_NAME | ||
@test ModelSelectionGUI.MODEL_SELECTION_VER == MODEL_SELECTION_VER | ||
@test ModelSelectionGUI.ENV_FILE_DEFAULT == ENV_FILE_DEFAULT | ||
@test ModelSelectionGUI.SERVER_HOST_DEFAULT == SERVER_HOST_DEFAULT | ||
@test ModelSelectionGUI.SERVER_PORT_DEFAULT == SERVER_PORT_DEFAULT | ||
@test ModelSelectionGUI.SSL_ENABLED_DEFAULT == SSL_ENABLED_DEFAULT | ||
@test ModelSelectionGUI.OPEN_DOCUMENTATION_DEFAULT == OPEN_DOCUMENTATION_DEFAULT | ||
@test ModelSelectionGUI.OPEN_CLIENT_DEFAULT == OPEN_CLIENT_DEFAULT | ||
@test ModelSelectionGUI.DATA == DATA | ||
@test ModelSelectionGUI.FILEHASH == FILEHASH | ||
@test ModelSelectionGUI.FILENAME == FILENAME | ||
@test ModelSelectionGUI.ID == ID | ||
@test ModelSelectionGUI.MESSAGE == MESSAGE | ||
@test ModelSelectionGUI.PARAMETERS == PARAMETERS | ||
@test ModelSelectionGUI.TEMP_FILENAME == TEMP_FILENAME | ||
@test ModelSelectionGUI.NCORES == NCORES | ||
@test ModelSelectionGUI.NWORKERS == NWORKERS | ||
@test ModelSelectionGUI.MODEL_SELECTION_VERSION == MODEL_SELECTION_VERSION | ||
@test ModelSelectionGUI.JULIA_VERSION == JULIA_VERSION | ||
@test ModelSelectionGUI.JOBS_QUEUE_SIZE == JOBS_QUEUE_SIZE | ||
@test ModelSelectionGUI.STATUS == STATUS | ||
@test ModelSelectionGUI.JOB_ID == JOB_ID | ||
@test ModelSelectionGUI.ENQUEUED == ENQUEUED | ||
@test ModelSelectionGUI.RUNNING == RUNNING | ||
@test ModelSelectionGUI.FINISHED == FINISHED | ||
@test ModelSelectionGUI.FAILED == FAILED | ||
@test ModelSelectionGUI.PENDING == PENDING | ||
@test ModelSelectionGUI.ESTIMATOR == ESTIMATOR | ||
@test ModelSelectionGUI.EQUATION == EQUATION | ||
@test ModelSelectionGUI.DATANAMES == DATANAMES | ||
@test ModelSelectionGUI.NOBS == NOBS | ||
@test ModelSelectionGUI.TIME_ENQUEUED == TIME_ENQUEUED | ||
@test ModelSelectionGUI.TIME_STARTED == TIME_STARTED | ||
@test ModelSelectionGUI.TIME_FINISHED == TIME_FINISHED | ||
@test ModelSelectionGUI.MSG == MSG | ||
@test ModelSelectionGUI.ALLSUBSETREGRESSION == ALLSUBSETREGRESSION | ||
@test ModelSelectionGUI.CROSSVALIDATION == CROSSVALIDATION | ||
@test ModelSelectionGUI.SUMMARY == SUMMARY | ||
@test for i in 1:length(ModelSelectionGUI.AVAILABLE_RESULTS_TYPES) | ||
ModelSelectionGUI.AVAILABLE_RESULTS_TYPES[i] == AVAILABLE_RESULTS_TYPES[i] | ||
end | ||
@test ModelSelectionGUI.DEFAULT_WS_CHANNEL == DEFAULT_WS_CHANNEL | ||
@test ModelSelectionGUI.RESULTS == RESULTS | ||
@test ModelSelectionGUI.CSV_MIME == CSV_MIME | ||
@test ModelSelectionGUI.PLAIN_MIME == PLAIN_MIME | ||
end |