Compare commits
6 Commits
ci/securit
...
ci/update_
| Author | SHA1 | Date | |
|---|---|---|---|
| 195a382af4 | |||
| 74d941c249 | |||
| f601593c77 | |||
|
|
e0d93cd84e | ||
| 803dffb9cd | |||
|
|
3cbafa51be |
@@ -14,7 +14,8 @@ workflow:
|
||||
|
||||
include:
|
||||
- template: Security/Secret-Detection.gitlab-ci.yml
|
||||
|
||||
- project: "bec/awi_utils"
|
||||
file: "awi_utils/test_pkg_versions/.gitlab-ci-job-check-pkg.yml"
|
||||
|
||||
#commands to run in the Docker container before starting each job.
|
||||
before_script:
|
||||
@@ -53,10 +54,10 @@ pylint-check:
|
||||
script:
|
||||
# Identify changed Python files
|
||||
- if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then
|
||||
TARGET_BRANCH_COMMIT_SHA=$(git rev-parse $CI_MERGE_REQUEST_TARGET_BRANCH_NAME);
|
||||
CHANGED_FILES=$(git diff --name-only $SOURCE_BRANCH_COMMIT_SHA $TARGET_BRANCH_COMMIT_SHA | grep '\.py$' || true);
|
||||
TARGET_BRANCH_COMMIT_SHA=$(git rev-parse $CI_MERGE_REQUEST_TARGET_BRANCH_NAME);
|
||||
CHANGED_FILES=$(git diff --name-only $SOURCE_BRANCH_COMMIT_SHA $TARGET_BRANCH_COMMIT_SHA | grep '\.py$' || true);
|
||||
else
|
||||
CHANGED_FILES=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep '\.py$' || true);
|
||||
CHANGED_FILES=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep '\.py$' || true);
|
||||
fi
|
||||
- if [ -z "$CHANGED_FILES" ]; then echo "No Python files changed."; exit 0; fi
|
||||
|
||||
@@ -75,10 +76,10 @@ pylint-check:
|
||||
|
||||
secret_detection:
|
||||
before_script:
|
||||
- ''
|
||||
- ""
|
||||
|
||||
config_test:
|
||||
stage: test
|
||||
stage: test
|
||||
script:
|
||||
- ophyd_test --config ./csaxs_bec/device_configs/ --output ./config_tests
|
||||
artifacts:
|
||||
@@ -88,7 +89,6 @@ config_test:
|
||||
expire_in: "30 days"
|
||||
allow_failure: true
|
||||
|
||||
|
||||
pytest:
|
||||
stage: test
|
||||
script:
|
||||
|
||||
@@ -4,7 +4,7 @@ from ophyd import Component as Cpt
|
||||
from ophyd import Device
|
||||
from ophyd import DynamicDeviceComponent as Dcpt
|
||||
from ophyd import EpicsSignal
|
||||
from prettytable import FRAME, PrettyTable
|
||||
from prettytable import PrettyTable, FRAME
|
||||
|
||||
|
||||
class OMNYSampleStorageError(Exception):
|
||||
@@ -28,6 +28,7 @@ class OMNYSampleStorage(Device):
|
||||
"unset_shuttle_slot",
|
||||
"get_shuttle_name_slot",
|
||||
"is_shuttle_slot_used",
|
||||
"search_shuttle_in_slot",
|
||||
"show_all",
|
||||
]
|
||||
SUB_VALUE = "value"
|
||||
@@ -59,7 +60,7 @@ class OMNYSampleStorage(Device):
|
||||
parking_placed = Dcpt(parking_placed)
|
||||
|
||||
sample_placed = {
|
||||
f"parking{i}": (EpicsSignal, f"XOMNY-SAMPLE_DB_omny:{i}", {})
|
||||
f"sample{i}": (EpicsSignal, f"XOMNY-SAMPLE_DB_omny:{i}", {})
|
||||
for i in [10, 11, 12, 13, 14, 32, 33, 34, 100, 101]
|
||||
}
|
||||
sample_placed = Dcpt(sample_placed)
|
||||
@@ -227,11 +228,25 @@ class OMNYSampleStorage(Device):
|
||||
val = self.sample_in_samplestage_name.get()
|
||||
return str(val)
|
||||
|
||||
def search_shuttle_in_slot(self, shuttle: str) -> int:
|
||||
returnvalue = 0
|
||||
for i in range(1, 7):
|
||||
if self.get_shuttle_name_slot(i) == shuttle:
|
||||
returnvalue = i
|
||||
return returnvalue
|
||||
|
||||
def show_all(self):
|
||||
t = PrettyTable()
|
||||
red = "\x1b[91m"
|
||||
green = "\x1b[92m"
|
||||
white = "\x1b[0m"
|
||||
for ch in ["A", "B", "C"]:
|
||||
t.clear()
|
||||
t.title = "Shuttle " + ch
|
||||
shuttle_in_slot = self.search_shuttle_in_slot(ch)
|
||||
if shuttle_in_slot > 0:
|
||||
t.title = green + "Shuttle " + ch + " in OMNY slot " + str(shuttle_in_slot) + white
|
||||
else:
|
||||
t.title = red + "Shuttle " + ch + white
|
||||
field_names = [""]
|
||||
for ax in [1, 3, 5]:
|
||||
row = []
|
||||
|
||||
@@ -94,7 +94,7 @@ class GalilController(Controller):
|
||||
if axis_Id is None and axis_Id_numeric is not None:
|
||||
axis_Id = self.axis_Id_numeric_to_alpha(axis_Id_numeric)
|
||||
is_moving = bool(float(self.socket_put_and_receive(f"MG_BG{axis_Id}")) != 0)
|
||||
backlash_is_active = bool(float(self.socket_put_and_receive(f"MGbcklact[axis]")) != 0)
|
||||
backlash_is_active = bool(float(self.socket_put_and_receive(f"MGbcklact[{axis_Id_numeric}]")) != 0)
|
||||
return bool(
|
||||
is_moving or backlash_is_active or self.is_thread_active(0) or self.is_thread_active(2)
|
||||
)
|
||||
|
||||
@@ -77,7 +77,7 @@ def test_axis_put(leyey, target_pos, socket_put_messages, socket_get_messages):
|
||||
b"XQ#NEWPAR\r",
|
||||
b"XQ#FES\r",
|
||||
b"MG_BGA\r",
|
||||
b"MGbcklact[axis]\r",
|
||||
b"MGbcklact[0]\r",
|
||||
b"MG_XQ0\r",
|
||||
b"MG_XQ2\r",
|
||||
b"MG _LRA, _LFA\r",
|
||||
@@ -93,7 +93,7 @@ def test_axis_put(leyey, target_pos, socket_put_messages, socket_get_messages):
|
||||
b"XQ#NEWPAR\r",
|
||||
b"XQ#FES\r",
|
||||
b"MG_BGB\r",
|
||||
b"MGbcklact[axis]\r",
|
||||
b"MGbcklact[1]\r",
|
||||
b"MG_XQ0\r",
|
||||
b"MG_XQ2\r",
|
||||
b"MG _LRB, _LFB\r",
|
||||
@@ -119,7 +119,7 @@ def test_drive_axis_to_limit(leyex, axis_nr, direction, socket_put_messages, soc
|
||||
b"XQ#NEWPAR\r",
|
||||
b"XQ#FRM\r",
|
||||
b"MG_BGA\r",
|
||||
b"MGbcklact[axis]\r",
|
||||
b"MGbcklact[0]\r",
|
||||
b"MG_XQ0\r",
|
||||
b"MG_XQ2\r",
|
||||
b"MG axisref[0]\r",
|
||||
@@ -133,7 +133,7 @@ def test_drive_axis_to_limit(leyex, axis_nr, direction, socket_put_messages, soc
|
||||
b"XQ#NEWPAR\r",
|
||||
b"XQ#FRM\r",
|
||||
b"MG_BGB\r",
|
||||
b"MGbcklact[axis]\r",
|
||||
b"MGbcklact[1]\r",
|
||||
b"MG_XQ0\r",
|
||||
b"MG_XQ2\r",
|
||||
b"MG axisref[1]\r",
|
||||
|
||||
Reference in New Issue
Block a user