For the worker to work, it needs:
-
Running backend storage server: NATS
-
One or more workers running:
taskiq worker
-
A driver that requests the tasks (e.g. unit test)
To get the NATS server running, install it with
curl -sf https://binaries.nats.dev/nats-io/nats-server/v2@latest | sh
Put the following configuration into a file, e.g. ~/.config/nats/nats-config.conf
:
listen: 0.0.0.0:4222
authorization: {
token: "szakal"
}
jetstream {
# Jetstream storage location, limits and encryption
store_dir: "/home/Adama-docs/nats"
# 1GB
max_memory_store: 1073741824
# 10GB
max_file_store: 10737418240
}
Obviously, the token should be a little more secure.
Then run the server with:
nats-server --config ~/.config/nats/nats-config.conf
Taskiq workers are driven by the taskiq
command. To get it working, install the current repository with poetry install
or pip install .
.
Then enter its environment (e.g. poetry shell
or . vevn/bin/activate
).
Once there, a taskiq
command will be available. To run a broker capable of running all the workers defined in the project, run:
worker StanTasq:broker
Broker will find the tasks, because each task is decorated with the @broker
decorator, and loaded on project’s startup in init.py
.
-
Test serializable type that is a union of many:
Union[ResultError, ResultFullSamples, ResultCovariances, ResultMainEffects, ResultRawMCMC, ResultRawPathfinder, ResultRawVB, ResultRawLaplace]
. Use Multiple Pydantic Models with a Discriminated Union: https://blog.det.life/pydantic-for-experts-discriminated-unions-in-pydantic-v2-2d9ca965b22f -
Implement types that hold results, for each type of StanResultEngine, StanOutputScope and error type.
-
If there is StanErrorType of SYNTAX_ERROR, COMPILE_ERROR or DATA_ERROR: the result will be of type ResultError.
-
For StanOutputScope.RawOutput each element of StanResultEngine will have its own dedicated result type. Errors of type RUNTIME_ERROR will be stored in the object.
-
For all other StanOutputScope types, the result will be one of: ResultFullSamples, ResultCovariances or ResultMainEffects. Errors of type RUNTIME_ERROR will be stored in the object.
-
-
Test error handling in every stage of the task:
-
reading in the model,
-
compiling the model,
-
testing if data fits the model,
-
running the model
-
-
Add functionality to search for the result in "AllTasks" based on the request cache.
-
Test
just test
recipe. -
Implement serialization as the RAW scope.
-
Rename serialized model files to have a proper extension. Bin? Obj? Zip?
-
Consider code de-duplication between local test result and remote test result.