Skip to content

Commit

Permalink
Merge branch 'ControlSystemStudio:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
caraxlr authored Feb 6, 2024
2 parents 82dc0b4 + 7db7229 commit 8a9030d
Show file tree
Hide file tree
Showing 854 changed files with 27,224 additions and 15,544 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Phoebus build

on: [push, pull_request]
on:
push:
branches-ignore:
- 'master'
pull_request:

jobs:
build:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build_latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Phoebus build

on:
push:
branches:
- master

jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
- name: Build
run: mvn --batch-mode install -DskipTests

- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: Phoebus product ${{ matrix.os }}
path: |
${{ github.workspace }}/phoebus-product/target/*.tar.gz
${{ github.workspace }}/phoebus-product/target/*.zip
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,9 @@ phoebus-product/settings_template.ini

# hs_err* files
**/hs_err*

# doc files generated by docs/source/conf.py
docs/source/applications.rst
docs/source/preference_properties.rst
docs/source/services.rst

15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.12"

# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/source/requirements.txt
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ https://control-system-studio.readthedocs.io

## Requirements
- [JDK11 or later, suggested is OpenJDK](http://jdk.java.net/12).
- [maven 2.x](https://maven.apache.org/) or [ant](http://ant.apache.org/)
- [maven 3.x](https://maven.apache.org/) or [ant](http://ant.apache.org/)


## Target Platform
Expand Down Expand Up @@ -218,9 +218,12 @@ To build for a different platform, create the `dependencies` in one of these way
# Either create the build platform for Linux..
( cd phoebus; mvn clean verify -Djavafx.platform=linux -f dependencies/pom.xml )

# or Mac OS X ..
# or Mac OS X (Intel)
( cd phoebus; mvn clean verify -Djavafx.platform=mac -f dependencies/pom.xml )

# or Mac OS X (M2)
( cd phoebus; mvn clean verify -Djavafx.platform=mac-aarch64 -f dependencies/pom.xml )

# or Windows:
( cd phoebus; mvn clean verify -Djavafx.platform=win -f dependencies/pom.xml )

Expand Down Expand Up @@ -249,10 +252,10 @@ Create a sonatype account and update the maven settings.xml file with your sonat
**Prepare the release**
`mvn release:prepare`
In this step will ensure there are no uncommitted changes, ensure the versions number are correct, tag the scm, etc.
A full list of checks is documented [here](https://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html).
A full list of checks is documented [here](https://maven.apache.org/maven-release/maven-release-plugin/usage/prepare-release.html).

**Perform the release**
`mvn -Pdocs release:perform`
`mvn -Darguments="-Dskip-executable-jar" -Pdocs,releases release:perform`
Checkout the release tag, build, sign and push the build binaries to sonatype. The `docs` profile is needed in order
to create required javadocs jars.

Expand Down
6 changes: 3 additions & 3 deletions app/3d-viewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<parent>
<groupId>org.phoebus</groupId>
<artifactId>app</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</parent>
<artifactId>app-3d-viewer</artifactId>
<dependencies>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-ui</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-framework</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
2 changes: 1 addition & 1 deletion app/alarm/datasource/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ to take a set of actions needed to effectively handle an alarm.

The alarm datasource provides a subsection of the alarm information and functionality.
This makes it possible for user to access beast alarm information of any other cs-studio application.
OPI screens can now embed informatino about from the alarm server, like the acknowledgement state of a pv, etc..
OPI screens can now embed information about from the alarm server, like the acknowledgement state of a pv, etc..

PV syntax
---------
Expand Down
14 changes: 7 additions & 7 deletions app/alarm/datasource/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.phoebus</groupId>
<artifactId>app-alarm</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</parent>
<artifactId>app-alarm-datasouce</artifactId>
<dependencies>
Expand All @@ -22,32 +22,32 @@
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-framework</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-types</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-pv</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-util</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-ui</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>app-alarm-model</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.sociaal</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ public static synchronized void acknowledgePV(AlarmPV alarmPV, boolean ack)
}
if (node != null)
{
try {
alarmModels.get(alarmPV.getInfo().getRoot()).acknowledge(node, ack);
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to acknowledge alarm", e);
}
AlarmTreeItem<?> alarmClientNode = node;
JobManager.schedule("Acknowledge/unacknowledge alarm", monitor -> {
try {
alarmModels.get(alarmPV.getInfo().getRoot()).acknowledge(alarmClientNode, ack);
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to acknowledge alarm", e);
}
});
}
}
}
Expand Down Expand Up @@ -153,8 +156,14 @@ public static synchronized void enablePV(AlarmPV alarmPV, boolean enable)
for (AlarmClientLeaf pv : pvs)
{
final AlarmClientLeaf copy = pv.createDetachedCopy();
if (copy.setEnabled(enable))
alarmModels.get(alarmPV.getInfo().getRoot()).sendItemConfigurationUpdate(pv.getPathName(), copy);
if (copy.setEnabled(enable)){
try {
alarmModels.get(alarmPV.getInfo().getRoot()).sendItemConfigurationUpdate(pv.getPathName(), copy);
} catch (Exception e) {
logger.log(Level.WARNING, "Failed to send item configuration update to " + alarmPV.getInfo().getRoot(), e);
throw e;
}
}
}
});
}
Expand Down
14 changes: 7 additions & 7 deletions app/alarm/logging-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
<parent>
<groupId>org.phoebus</groupId>
<artifactId>app-alarm</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</parent>
<artifactId>app-alarm-logging-ui</artifactId>
<dependencies>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-framework</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-ui</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-types</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-util</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>app-alarm-model</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.phoebus</groupId>
<artifactId>app-alarm-ui</artifactId>
<version>4.7.2-SNAPSHOT</version>
<version>4.7.4-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,37 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.jersey.api.client.WebResource;
import javafx.collections.ObservableMap;
import org.phoebus.applications.alarm.logging.ui.AlarmLogTableQueryUtil.Keys;
import org.phoebus.framework.jobs.Job;
import org.phoebus.framework.jobs.JobManager;
import org.phoebus.framework.jobs.JobMonitor;
import org.phoebus.framework.jobs.JobRunnable;
import org.phoebus.framework.preferences.PreferencesReader;
import org.phoebus.applications.alarm.logging.ui.AlarmLogTableQueryUtil.Keys;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.stream.Collectors;

import static org.phoebus.applications.alarm.logging.ui.AlarmLogTableApp.logger;

/**
* A Job to search for alarm messages logged by the alarm logging service
*
* @author Kunal Shroff
*/
public class AlarmLogSearchJob implements JobRunnable {
private final Boolean isNodeTable;
private final ObservableMap<Keys, String> searchParameters;
private final Consumer<List<AlarmLogTableItem>> alarmMessageHandler;
private final BiConsumer<String, Exception> errorHandler;

private final ObjectMapper objectMapper;
private final WebResource client;

private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")
.withZone(ZoneId.of("UTC"));
private final PreferencesReader prefs = new PreferencesReader(AlarmLogTableApp.class,
"/alarm_logging_preferences.properties");

Expand All @@ -58,7 +54,6 @@ private AlarmLogSearchJob(WebResource client, Boolean isNodeTable, ObservableMap
Consumer<List<AlarmLogTableItem>> alarmMessageHandler, BiConsumer<String, Exception> errorHandler) {
super();
this.client = client;
this.isNodeTable = isNodeTable;
this.searchParameters = searchParameters;
this.alarmMessageHandler = alarmMessageHandler;
this.errorHandler = errorHandler;
Expand All @@ -68,31 +63,30 @@ private AlarmLogSearchJob(WebResource client, Boolean isNodeTable, ObservableMap

@Override
public void run(JobMonitor monitor) {
monitor.beginTask("searching for alarm log entires : " +
searchParameters.entrySet().stream().map(e-> e.getKey() + ":" + e.getValue()).collect(Collectors.joining()));
String searchString = "searching for alarm log entries : " +
searchParameters.entrySet().stream().filter(e -> !e.getValue().equals("")).map(e -> e.getKey() + ":" + e.getValue()).collect(Collectors.joining(","));
logger.log(Level.INFO, "Searching for alarm entries: " + searchString);
monitor.beginTask(searchString);
int size = prefs.getInt("results_max_size");

MultivaluedMap<String, String> map = new MultivaluedHashMap<>();
searchParameters.entrySet().forEach(e -> {
map.add(e.getKey().getName(), e.getValue());
}
);
map.putIfAbsent("size", Arrays.asList(String.valueOf(size)));
searchParameters.forEach((key, value) -> { if (!value.equals("")) map.add(key.getName(), value); });
map.putIfAbsent("size", List.of(String.valueOf(size)));

try {

long start = System.currentTimeMillis();
String resultStr = client.path("/search/alarm")
String resultStr = client.path("/search/alarm")
.queryParams(map)
.accept(MediaType.APPLICATION_JSON).get(String.class);

logger.log(Level.FINE,"String response = " + (System.currentTimeMillis() - start));
logger.log(Level.FINE, "String response = " + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
List<AlarmLogTableItem> result = objectMapper.readValue(resultStr, new TypeReference<List<AlarmLogTableItem>>() {
List<AlarmLogTableItem> result = objectMapper.readValue(resultStr, new TypeReference<>() {
});
logger.log(Level.FINE,"Object mapper response = " + (System.currentTimeMillis() - start));
logger.log(Level.FINE, "Object mapper response = " + (System.currentTimeMillis() - start));
alarmMessageHandler.accept(result);
} catch (JsonProcessingException e) {
} catch (Exception e) {
errorHandler.accept("Failed to search for alarm logs ", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public AppInstance create() {
}

/**
* Support the launching of alarmLogtable using resource alarmLog://?<search_string>
* Support the launching of alarmLogtable using resource {@literal alarmLog://?<search_string>}
* e.g.
* -resource alarmLog://?pv=SR*
*/
Expand Down
Loading

0 comments on commit 8a9030d

Please sign in to comment.