Commit 45d17eae authored by Matias Guijarro's avatar Matias Guijarro

Merge branch 'nxw_logging_bug' into 'master'

Nxw logging bug

See merge request !2037
parents ea2e73f4 b6f354bf
Pipeline #21210 canceled with stages
in 5 minutes and 6 seconds
......@@ -255,7 +255,7 @@ class Writer(FileWriter):
@property
def session_state_reason(self):
proxy = self.writer_proxy
return proxy.state_reason
return proxy.status
@property
def scan_state(self):
......@@ -279,7 +279,7 @@ class Writer(FileWriter):
# @skip_when_fault
@mark_fault_on_exception
@retry_session_method(err_msg="Nexus writer service is not ON or RUNNING")
@retry_session_method(err_msg="Nexus writer is not ON or RUNNING")
def session_writer_on(self):
"""
:returns bool: state is valid and expected
......@@ -300,7 +300,7 @@ class Writer(FileWriter):
@skip_when_fault
@mark_fault_on_exception
@retry_scan_method(err_msg="Data writer has not finished")
@retry_scan_method(err_msg="Nexus writer has not finished")
def scan_writer_finished(self):
"""
:returns bool: state is valid and expected
......@@ -312,14 +312,14 @@ class Writer(FileWriter):
elif state == DevState.FAULT:
reason = self.scan_state_reason
raise RuntimeError(
"Data writer is in FAULT state due to {}".format(repr(reason))
"Nexus writer is in FAULT state due to {}".format(repr(reason))
)
else:
return False
# @skip_when_fault
@mark_fault_on_exception
@retry_scan_method(err_msg="Data writer is not in valid state")
@retry_scan_method(err_msg="Nexus writer is not in valid state")
def valid_scan_writer(self):
"""
:returns bool: state is valid and expected
......@@ -329,26 +329,26 @@ class Writer(FileWriter):
if state == DevState.FAULT:
reason = self.scan_state_reason
raise RuntimeError(
"Data writer is in FAULT state due to {}".format(repr(reason))
"Nexus writer is in FAULT state due to {}".format(repr(reason))
)
else:
return True
# @skip_when_fault
@mark_fault_on_exception
@retry_scan_method(err_msg="Data writer does not have write permissions")
@retry_scan_method(err_msg="Nexus writer does not have write permissions")
def scan_permitted(self):
"""
:returns bool: writer can write
:raises RuntimeError: invalid state
"""
if not self._scan_permitted:
raise RuntimeError("Data writer does not have write permissions")
raise RuntimeError("Nexus writer does not have write permissions")
return True
# @skip_when_fault
@mark_fault_on_exception
@retry_scan_method(err_msg="Data writer is created")
@retry_scan_method(err_msg="Nexus writer did not receive the start-scan event")
def scan_exists(self):
"""
:returns bool: writer exists
......
......@@ -309,7 +309,10 @@ class NexusSessionWriter(base_subscriber.BaseSubscriber):
def log_progress(self, msg=None):
n = len(self.writers)
nactivate = sum(w.active for w in self.writers.values())
msg = "{} scan writers ({} activate)".format(n, nactivate)
if msg:
msg = "{} ({} scan writers, {} activate)".format(msg, n, nactivate)
else:
msg = "{} scan writers ({} activate)".format(n, nactivate)
self.logger.info(msg)
if self.resource_profiling:
self.log_resources()
......
......@@ -181,8 +181,6 @@ class NexusWriter(Device):
# Attributes
# ----------
state_reason = attribute(dtype="DevString")
resource_profiling = attribute(dtype="DevBoolean", access=AttrWriteType.READ_WRITE)
scan_states = attribute(dtype=("DevState",), max_dim_x=10000)
......@@ -244,12 +242,6 @@ class NexusWriter(Device):
# Attributes methods
# ------------------
def read_state_reason(self):
# PROTECTED REGION ID(NexusWriter.state_reason_read) ENABLED START #
"""Return the state_reason attribute."""
return self.session_writer.state_reason
# PROTECTED REGION END # // NexusWriter.state_reason_read
def read_resource_profiling(self):
# PROTECTED REGION ID(NexusWriter.resource_profiling_read) ENABLED START #
"""Return the resource_profiling attribute."""
......@@ -366,7 +358,7 @@ class NexusWriter(Device):
:return:'ConstDevString'
Device status
"""
return self.dev_state().name
return self.session_writer.state_reason
# PROTECTED REGION END # // NexusWriter.Status
@command(dtype_in="DevString", doc_in="scan", dtype_out="DevState")
......
......@@ -161,14 +161,6 @@
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="state_reason" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="resource_profiling" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:BooleanType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment