Skip to content

Commit

Permalink
Jd/hotfixes (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday authored Jul 15, 2023
1 parent 0902a3a commit 24a1b1c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
tag: ${{ needs.tag-generator.outputs.image-tag }}
secrets:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ url = SimulationService.server_url[] # server url
model = JSON3.read(read("./examples/BIOMD0000000955_askenet.json"), Config)

# You can directly provide AMR JSON with the `test_amr` key
# (Note: this does not look like a request that would be seen in production)
json = Config(model = model, timespan=(0, 90))
# (Note: this does not entirely look like a request that would be seen in production)
json = @config(model = model, timespan.start=0, timespan.end=90, engine="sciml")

body = JSON3.write(json)

# Kick off the simulation job
res = HTTP.post("$url/simulate", ["Content-Type" => "application/json"]; body=body)

# Get the `job_id` so we can query the job status and get results
job_id = JSON3.read(res.body).simulation_id
# Get the `id` so we can query the job status and get results
id = JSON3.read(res.body).simulation_id

# Re-run this until `status_obj.status == "done"`
status = JSON3.read(HTTP.get("$url/jobs/status/$job_id").body)
status = JSON3.read(HTTP.get("$url/status/$id").body)

# close down server and scheduler
stop!()
Expand Down Expand Up @@ -103,7 +103,7 @@ all the necessary info for running/solving the model and returning results.
- Run/solve the model/simulation.
- Upload results to S3.
- Update job status in TDS to "complete".
4. Return a 201 response (above job runs async) with JSON that holds the `simulation_id` (client's term), which we call `job_id`.
4. Return a 201 response (above job runs async) with JSON that holds the `simulation_id` (client's term), which we call `id`.


## Architecture
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM julia:1.9
WORKDIR /simulation-service

# Install dependencies
COPY Manifest.toml /simulation-service/
# COPY Manifest.toml /simulation-service/
COPY Project.toml /simulation-service/
ENV JULIA_PROJECT=.
RUN julia -e 'using Pkg; Pkg.instantiate();'
Expand Down
8 changes: 3 additions & 5 deletions src/SimulationService.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ function start!(; host=HOST, port=PORT, kw...)
Oxygen.@post "/{operation_name}" operation
Oxygen.@post "/kill/{id}" job_kill

# TODO: bring docs/ back
# Issue? https://github.com/JuliaData/YAML.jl/issues/117
# api = SwaggerMarkdown.OpenAPI("3.0", Dict(string(k) => v for (k,v) in openapi_spec[]))
# swagger = SwaggerMarkdown.build(api)
# Oxygen.mergeschema(swagger)
_dict(x) = string(x)
_dict(x::Config) = Dict{String,Any}(string(k) => _dict(v) for (k,v) in x)
Oxygen.mergeschema(_dict(openapi_spec[]))

if Threads.nthreads() > 1 # true in production
Oxygen.serveparallel(; host, port, async=true, kw...)
Expand Down

0 comments on commit 24a1b1c

Please sign in to comment.