Skip to content

Commit

Permalink
Merge pull request #109 from SNEWS2/sybenzvi/rename-config-folder
Browse files Browse the repository at this point in the history
Sybenzvi/rename config folder
  • Loading branch information
sybenzvi authored Aug 14, 2024
2 parents e29b8cc + b5a3df0 commit f71f103
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ doc/_build/
*.log
/snews_cs/hop_sub.py
/snews_cs/slack_alert.py
/snews_cs/auxiliary/test-config.env
/snews_cs/etc/test-config.env
firedrill.ipynb
server_run_me.py
*.db
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ The backend tools that needs to run in order for the observation messages to be

The **observation messages** submitted to a given kafka topic using the [SNEWS Publishing Tools](https://github.com/SNEWS2/SNEWS_Publishing_Tools). The SNEWS Coincidence System listen this topic and caches all the messages submitted. These messages then assigned to different _sublists_ depending on their `neutrino_time`.

The first message in the stream makes the first sublist as `sublist=0`, and sets the coincidence window. Next, the second message is compared against the first and if the `neutrino_time` differences are less than the defined `coincidence_threshold` ([default](https://github.com/SNEWS2/SNEWS_Coincidence_System/blob/main/snews_cs/auxiliary/test-config.env) is 10sec) it is added to the same _sublist_ and an alert is triggered. This alert is sent to all subscribed users through the Kafka Alert Channels, and a slack bot message is published on the relavant SNEWS Slack channel. In case if the second message is earlier than the first one and there were no alerts triggered before (the first message was alone), then the second message is replaced as the _initial message_ of that sublist and the coincidence window is started from the neutrino time of the second message. The alert is still published.
The first message in the stream makes the first sublist as `sublist=0`, and sets the coincidence window. Next, the second message is compared against the first and if the `neutrino_time` differences are less than the defined `coincidence_threshold` ([default](https://github.com/SNEWS2/SNEWS_Coincidence_System/blob/main/snews_cs/etc/test-config.env) is 10sec) it is added to the same _sublist_ and an alert is triggered. This alert is sent to all subscribed users through the Kafka Alert Channels, and a slack bot message is published on the relavant SNEWS Slack channel. In case if the second message is earlier than the first one and there were no alerts triggered before (the first message was alone), then the second message is replaced as the _initial message_ of that sublist and the coincidence window is started from the neutrino time of the second message. The alert is still published.

If there are more incoming observation messages, they are compared against the _initial message_ of each sublist i.e. if the neutrino time difference of the 3rd (or later) messages are within +10 seconds they are added to the same sublist, and another alert message is published, only this time stating that it is an **"UPDATE"** on the previous alert message.

Expand Down
2 changes: 1 addition & 1 deletion doc/user/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The backend tools that needs to run in order for the observation messages to be

The **observation messages** submitted to a given kafka topic using the [SNEWS Publishing Tools](https://github.com/SNEWS2/SNEWS_Publishing_Tools). The SNEWS Coincidence System listen this topic and caches all the messages submitted. These messages then assigned to different _sublists_ depending on their `neutrino_time`.

The first message in the stream makes the first sublist as `sublist=0`, and sets the coincidence window. Next, the second message is compared against the first and if the `neutrino_time` differences are less than the defined `coincidence_threshold` ([default](https://github.com/SNEWS2/SNEWS_Coincidence_System/blob/main/snews_cs/auxiliary/test-config.env) is 10sec) it is added to the same _sublist_ and an alert is triggered. This alert is sent to all subscribed users through the Kafka Alert Channels, and a slack bot message is published on the relavant SNEWS Slack channel. In case if the second message is earlier than the first one and there were no alerts triggered before (the first message was alone), then the second message is replaced as the _initial message_ of that sublist and the coincidence window is started from the neutrino time of the second message. The alert is still published.
The first message in the stream makes the first sublist as `sublist=0`, and sets the coincidence window. Next, the second message is compared against the first and if the `neutrino_time` differences are less than the defined `coincidence_threshold` ([default](https://github.com/SNEWS2/SNEWS_Coincidence_System/blob/main/snews_cs/etc/test-config.env) is 10sec) it is added to the same _sublist_ and an alert is triggered. This alert is sent to all subscribed users through the Kafka Alert Channels, and a slack bot message is published on the relavant SNEWS Slack channel. In case if the second message is earlier than the first one and there were no alerts triggered before (the first message was alone), then the second message is replaced as the _initial message_ of that sublist and the coincidence window is started from the neutrino time of the second message. The alert is still published.

If there are more incoming observation messages, they are compared against the _initial message_ of each sublist i.e. if the neutrino time difference of the 3rd (or later) messages are within +10 seconds they are added to the same sublist, and another alert message is published, only this time stating that it is an **"UPDATE"** on the previous alert message.

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ keywords =
packages =
SNEWS_CS
data_files =
auxiliary/ = ./auxiliary/*
etc/ = ./etc/*
6 changes: 3 additions & 3 deletions snews_cs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
@click.group(invoke_without_command=True)
@click.version_option(__version__)
@click.option('--env', type=str,
default='/auxiliary/test-config.env',
show_default='auxiliary/test-config.env',
default='/etc/test-config.env',
show_default='etc/test-config.env',
help='environment file containing the configurations')
@click.pass_context
def main(ctx, env):
Expand Down Expand Up @@ -67,4 +67,4 @@ def run_feedback(verbose):


if __name__ == "__main__":
main()
main()
2 changes: 1 addition & 1 deletion snews_cs/cs_alert_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CoincidenceTierAlert:
----------
env_path : `str`, optional
The path containing the environment configuration file
If None, uses the default file in '/auxiliary/test-config.env'
If None, uses the default file in '/etc/test-config.env'
"""

Expand Down
2 changes: 1 addition & 1 deletion snews_cs/cs_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
if os.getenv("smtp_server_addr") is not None:
smtpserver = os.getenv("smtp_server_addr")

contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'auxiliary/contact_list.json'))
contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'etc/contact_list.json'))
with open(contact_list_file) as file:
contact_list = json.load(file)

Expand Down
2 changes: 1 addition & 1 deletion snews_cs/cs_remote_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"Get-Feedback"
]

contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'auxiliary/contact_list.json'))
contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'etc/contact_list.json'))
with open(contact_list_file) as file:
contact_list = json.load(file)

Expand Down
2 changes: 1 addition & 1 deletion snews_cs/cs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def set_env(env_path=None):
Use default settings if not given
"""
default_env_path = os.path.dirname(__file__) + '/auxiliary/test-config.env'
default_env_path = os.path.dirname(__file__) + '/etc/test-config.env'
env = env_path or default_env_path
load_dotenv(env)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MSG_EXPIRATION=120

# HB configs
STORE_HEARTBEAT="True"
HB_STASH_TIME="24" # hours
#HB_STASH_TIME="24" # hours
HB_DELETE_AFTER="7" # days

# Send heartbeats from the following email
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions snews_cs/heartbeat_feedbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

log = getLogger(__name__)

contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'auxiliary/contact_list.json'))
contact_list_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'etc/contact_list.json'))
with open(contact_list_file) as file:
contact_list = json.load(file)

# Check if detector name is in registered list.
detector_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'auxiliary/detector_properties.json'))
detector_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'etc/detector_properties.json'))
with open(detector_file) as file:
snews_detectors = json.load(file)
snews_detectors = list(snews_detectors.keys())
Expand Down
4 changes: 2 additions & 2 deletions snews_cs/snews_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def get_image(is_test, alert_data, topic):

header = f"{test} *SUPERNOVA ALERT* {alert_type}".center(60, '=')+topic_str+f"{tag}" + \
f"> False Alarm Probability= *{falseprob}*\n> Issued from {server}"
giflink = "https://raw.githubusercontent.com/SNEWS2/SNEWS_Coincidence_System/main/snews_cs/auxiliary/snalert.gif"
giflink = "https://raw.githubusercontent.com/SNEWS2/SNEWS_Coincidence_System/main/snews_cs/etc/snalert.gif"
retractlink = "https://www.shutterstock.com/image-vector/ooops-word-bubble-pop-art-600w-408777070.jpg"
updatelink = "https://www.shutterstock.com/image-vector/vector-illustration-modern-label-new-600w-1520423249.jpg"
# updatelink = "https://raw.githubusercontent.com/SNEWS2/SNEWS_Coincidence_System/main/snews_cs/auxiliary/update_image.png"
# updatelink = "https://raw.githubusercontent.com/SNEWS2/SNEWS_Coincidence_System/main/snews_cs/etc/update_image.png"
#"https://www.ris.world/wp-content/uploads/2018/09/update.jpg"
sendlink = giflink if alert_type=="NEW_MESSAGE" else (updatelink if alert_type=="UPDATE" else retractlink)

Expand Down
2 changes: 1 addition & 1 deletion snews_cs/snews_coinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def __init__(self, env_path=None, drop_db=False, firedrill_mode=True, hb_path=No
Parameters
----------
env_path : `str`
path to env file, defaults to '/auxiliary/test-config.env'
path to env file, defaults to '/etc/test-config.env'
send_slack: `bool`
Whether to send alerts on slack
Expand Down
2 changes: 1 addition & 1 deletion snews_cs/snews_hb.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
log = getLogger(__name__)

# Check if detector name is in registered list.
detector_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'auxiliary/detector_properties.json'))
detector_file = os.path.abspath(os.path.join(os.path.dirname(__file__), 'etc/detector_properties.json'))

with open(detector_file) as file:
snews_detectors = json.load(file)
Expand Down
2 changes: 1 addition & 1 deletion snews_cs/snews_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Storage:
Parameters
----------
env : `str`, optional
Path to env file, defaults to './auxiliary/test-config.env'
Path to env file, defaults to './etc/test-config.env'
drop_db : `bool`, optional
drops all items in the DB every time Storage is initialized, defaults to False
Expand Down

0 comments on commit f71f103

Please sign in to comment.