Skip to content

Commit

Permalink
Merge branch 'ui-v2' of github.com:IGS/gEAR into ui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jorvis committed Sep 6, 2024
2 parents d54d05e + f1cc467 commit b3b903d
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/setup_rabbitmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ As root, I would create a file in `/var/log/gEAR_queue` named `<service>.log` wh

## Running a particular consumer

NOTE: This is automatically handled in the projectr_consumer system.d service file

First, make sure a directory is present under /var/log/gEAR_queue (you may have to create this as root). If you are not going to run the consumer listener as root, ensure the user has the same group-write privileges as the directory.

The consumer scripts are stored at `<root>/listeners/<files>`. Let it run in the background (preferably with `nohup`)
Expand Down
17 changes: 17 additions & 0 deletions systemd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# system.d files

These are service files to place in `/etc/systemd/system/` to run as a service.

The "@" in the service file name indicates that this file is a template file. You can spawn off workers off of this template by appending numbers after the "@". For instance, if you have a "[email protected]" template, you can spawn off "[email protected]", "[email protected]", etc. You can also just use the ".target" file to group all these workers together as a service rather than having to start each indiviudally. See https://www.stevenrombauts.be/2019/01/run-multiple-instances-of-the-same-systemd-unit/ for more info on all this.

## Non-persisting start

To start the service run `sudo systemctl start <service_filename>`. If any changes are made to the service run `sudo systemctl daemon-reload`, and then run the "start" command again. This will not persist during a reboot.

## Reboot-persisting start

To start a service that persists during a reboot, run `sudo systemctl enable <service_filename>`. After enabling, you will still need to run the `systemctl start` command to start on this boot session.

## Notes

* For a service that is supposed to persist, like a RabbitMQ consumer, use Service->Type=Simple. If you use Type->Forking, I believe systemctl will forever wait for the forked process to exit and return to command line.
6 changes: 6 additions & 0 deletions systemd/projectr-consumer.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=ProjectR Consumer Workers
[email protected] [email protected] [email protected]

[Install]
WantedBy=multi-user.target
17 changes: 17 additions & 0 deletions systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description="ProjectR Consumer for RabbitMQ - #%i"
Documentation=https://github.com/IGS/gEAR/blob/main/docs/setup_rabbitmq.md
After=rabbitmq-server.service

[Service]
Type=simple
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/opt/bin/python3 /home/jorvis/git/gEAR/listeners/projectr_consumer.py
KillMode=mixed
PrivateTmp=true
Restart=always
RestartSec=2s
StartLimitIntervalSec=0

[Install]
WantedBy=multi-user.target
9 changes: 5 additions & 4 deletions www/js/curator_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ const renderOrderSortableSeries = (series) => {
}

// Create sortable for this series
sortable(`#${series}-order-list`, {
sortable(`#${CSS.escape(series)}-order-list`, {
hoverClass: "has-text-weight-bold"
, itemSerializer(item, container) {
item.label = item.node.textContent
Expand Down Expand Up @@ -1494,10 +1494,11 @@ const updateOrderSortable = () => {
}

// Get all current plotting order series and save as a set
const sortableElts = document.querySelectorAll(".js-plot-order-sortable p");
// selector syntax from https://tobiasahlin.com/blog/previous-sibling-css-has/
const sortableElts = document.querySelectorAll("p:has(+ .js-plot-order-sortable)");
const sortableSet = new Set();
for (const elt of sortableElts) {
const series = elt.value;
const series = elt.textContent;
// These series already are categorical
if (series) {
sortableSet.add(series);
Expand All @@ -1510,7 +1511,7 @@ const updateOrderSortable = () => {
}

for (const series of sortableSet) {
// 3. Series is in sortableSet but not seriesSet, remove <series>-order element
// Series is in sortableSet but not seriesSet, remove <series>-order element
if (!seriesSet.has(series)) {
const orderElt = document.getElementById(`${series}-order`);
orderElt.remove();
Expand Down

0 comments on commit b3b903d

Please sign in to comment.