After installing the module, the command that does the magic is:
snews model
The two required options are:
- -f: the .env file for required environment variables.
- --no-auth: True to use the default .toml file. Otherwise, use Hopskotch authentication in the .env file.
So an example command would be
snews model --env-file config.env --no-auth
The user should create a .env file and pass the file path to the -f option when running SNEWS 2.0. The .env file should include the following:
- The definition of these environmental variables are:
- COINCIDENCE_THRESHOLD: maximum time (s) between messages for them to be considered coincident
- MSG_EXPIRATION: maximum time (s) that a message will be stored in the database cache before expiring
- TIME_STRING_FORMAT: the string format of time in all SNEWS messages.
- DATABASE_SERVER: the database server to that SNEWS 2.0 connects to in order to store messages for processing. In the current version, the app takes in a MongoDB server.
- NEW_DATABASE: "True" to drop all previous messages and "False" to keep them.
- OBSERVATION_TOPIC: the Hopskotch topic for detectors to publish messages to.
- TESTING_TOPIC: the optional topic for testing.
- ALERT_TOPIC: the Hopskotch topic for SNEWS 2.0 to publish alert messages to the detectors.
To configure a .toml file for hop-client module, follow the steps documented at https://github.com/scimma/hop-client and specify --default-authentiation as False.
Otherwise, in the .env file, include the following:
USERNAME=username
PASSWORD=password
where "username" and "password" are user credentials to Hopsckoth.
snews generate
can be used to simulate real-time messages from experiments:
snews generate
with options
- --env-file: the .env file for configuration.
- --rate: the rate of messages sent in seconds (e.g. 2 means one message every 2 seconds).
- --alert-probability: the discrete probability that the message is significant.
- --persist: continually send messages. If not specified, send only one message.
For example, to continuously publish two messages per second, each with a 10% probability of being a significant, enter:
snews generate --env-file config.env --rate 0.5 --alert-probability 0.1
If the user does not have access to the Hopskotch or MongoDB server or both, running local instances is a alternative choice.
- To run a Kafka instance, run the following in the shell
docker run -p 9092:9092 -it --rm --hostname localhost scimma/server:latest --noSecurity
and pass the following Kafka server to SNEWS 2.0
kafka://dev.hop.scimma.org:9092/USER-TOPIC
- To run a MongoDB instance, either run
docker run -p 27017:27017 -it --rm --hostname localhost mongo:latest
or run
pip install -U mongoengine
and pass the following MongoDB server to SNEWS 2.0
mongodb://localhost:27017/