Skip to content

Commit

Permalink
Update docs, examples + Fix intermediate hook (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
fivegrant committed Jul 11, 2023
1 parent 8e4dfc5 commit caeb2f7
Show file tree
Hide file tree
Showing 13 changed files with 769 additions and 566 deletions.
20 changes: 20 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Architecture

The Simulation Service (soon to be renamed SciML Service) is a REST API that wraps
specific SciML tasks. The service should match the spec [here](https://github.com/DARPA-ASKEM/simulation-api-spec)
since PyCIEMSS Service and SciML Service ideally are hot swappable.

The API creates a job using the JobSchedulers.jl library and updates the Terarium Data Service (TDS) with the status
of the job throughout its execution. Once the job completes, the results are written to S3. With most of the output artifacts, we do little postprocessing
after completing the SciML portion.

## Layout

Source is split into 5 major components:
- `SimulationService.jl`: Contains the start and stop functions for the service
- `Settings.jl`: Enumerates the environment variables used by the project
- `service`: Job scheduling, pre/post-processing, endpoints, etc. Handled by TA4.
- `contracts`: Location where TA3 and TA4 agree on an interface between the SciML Operations and the rest of the service.
- `Available.jl`: The operations available to the API are here. Generally, the operations just wrap around by the exposed SciML
operations.
- `operations`: JuliaHub primarily focuses here.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,25 @@ With docker compose:
docker compose --file docker/docker-compose.yml up --build
```

With Julia REPL:
With Julia REPL assuming you want to run it standalone:

```
julia> using SimulationService
>> export ENABLE_TDS=false # Include if you would like to disable backend services
>> julia --project --threads 15 # We need multithreading
julia> using SimulationService, HTTP
julia> import JSON3 as JSON
julia> start!()
julia> model_json = String(read("./examples/BIOMD0000000955_askenet.json"))
julia> # Let's do a simulate
julia> operation = "simulate"
julia> operation_args = Dict(:model=> model_json, :timespan => Dict("start" => 0, "end" => 90)) # should match up to what's in Availble.jl
julia> simulation = SimulationService.make_deterministic_run(operation_args, operation)
julia> simulation_id = JSON.read(String(simulation.body)).simulation_id
julia> status = SimulationService.retrieve_job(nothing, simulation_id, "status") # rerun until complete
julia> result = SimulationService.retrieve_job(nothing, simulation_id, "result")
julia> # output of REST API and Scheduler
julia> stop!()
julia> # you may safely leave the repl or rerun `start!`
````

To check available endpoints, try checking [localhost:8080/docs](localhost:8080/docs)
Loading

0 comments on commit caeb2f7

Please sign in to comment.