Skip to content
Snippets Groups Projects
Commit 3f706c81 authored by user's avatar user
Browse files

AT1-709: Resolve review comment- Address pylint warnings.

parent 4742ba55
Branches
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ from time import sleep ...@@ -7,6 +7,7 @@ from time import sleep
import os import os
from tango import DeviceProxy, DevFailed, AttributeProxy from tango import DeviceProxy, DevFailed, AttributeProxy
def cm_configure_attributes(): def cm_configure_attributes():
"""Method to configure an attribute.""" """Method to configure an attribute."""
configure_success_count = 0 configure_success_count = 0
...@@ -87,22 +88,23 @@ def cm_configure_attributes(): ...@@ -87,22 +88,23 @@ def cm_configure_attributes():
total_attrib_count, attribute_started_count, error_starting_attrib_count total_attrib_count, attribute_started_count, error_starting_attrib_count
def start_archiving(str_attribute, attribute_started_count, error_starting_attrib_count): def start_archiving(str_attribute, attribute_started, error_starting_attrib):
"""Method to start archiving an attribute.""" """Method to start archiving an attribute."""
try: try:
conf_manager_proxy.command_inout("AttributeStart", str_attribute) conf_manager_proxy.command_inout("AttributeStart", str_attribute)
attribute_started_count +=1 attribute_started += 1
except Exception as except_occured: except Exception as except_occured:
error_starting_attrib_count += 1 error_starting_attrib += 1
print("start_archiving except_occured: ", except_occured) print("start_archiving except_occured: ", except_occured)
return attribute_started_count, error_starting_attrib_count return attribute_started, error_starting_attrib
# Main entrypoint of the script. # Main entrypoint of the script.
CONF_MANAGER_DEVICE_FQDN = "" CONF_MANAGER_DEVICE_FQDN = ""
EVT_SUBSCRIBER_DEVICE_FQDN = "" EVT_SUBSCRIBER_DEVICE_FQDN = ""
ATTR_LIST_FILE = "" ATTR_LIST_FILE = ""
## parse arguments # parse arguments
try: try:
opts, args = getopt.getopt(sys.argv[1:], "c:e:a:", ["cm=", "es=", "attrfile="]) opts, args = getopt.getopt(sys.argv[1:], "c:e:a:", ["cm=", "es=", "attrfile="])
...@@ -129,16 +131,16 @@ SLEEP_TIME = 6 ...@@ -129,16 +131,16 @@ SLEEP_TIME = 6
MAX_RETRIES = 10 MAX_RETRIES = 10
for x in range(0, MAX_RETRIES): for x in range(0, MAX_RETRIES):
try: try:
configure_success_count, configure_fail_count, already_configured_count, \ configure_success_attr_count, configure_fail_attr_count, already_configured_attr_count, \
total_attrib_count, attribute_started_count, error_starting_attrib_count = \ total_attribute_count, attr_started_archiving_count, error_starting_attr_count = \
cm_configure_attributes() cm_configure_attributes()
print("Configured successfully: ", configure_success_count, "Failed: ", print("Configured successfully: ", configure_success_attr_count, "Failed: ",
configure_fail_count, "Already configured: ", configure_fail_attr_count, "Already configured: ",
already_configured_count, "Total attributes: ", already_configured_attr_count, "Total attributes: ",
total_attrib_count, "Attribute started: ", attribute_started_count, total_attribute_count, "Attribute started: ", attr_started_archiving_count,
"Error starting attribute: ", error_starting_attrib_count) "Error starting attribute: ", error_starting_attr_count)
break break
except: except Exception:
print("configure_attribute exception: " + str(sys.exc_info())) print("configure_attribute exception: " + str(sys.exc_info()))
if x == (MAX_RETRIES - 1): if x == (MAX_RETRIES - 1):
sys.exit(-1) sys.exit(-1)
...@@ -147,13 +149,13 @@ for x in range(0, MAX_RETRIES): ...@@ -147,13 +149,13 @@ for x in range(0, MAX_RETRIES):
DEVICE_ADM = None DEVICE_ADM = None
DEVICE_ADM = DeviceProxy("dserver/hdbppcm-srv/01") DEVICE_ADM = DeviceProxy("dserver/hdbppcm-srv/01")
DEVICE_ADM.RestartServer() DEVICE_ADM.RestartServer()
except: except Exception:
print("reset_conf_manager exception: " + str(sys.exc_info()[0])) print("reset_conf_manager exception: " + str(sys.exc_info()[0]))
sleep(SLEEP_TIME) sleep(SLEEP_TIME)
if configure_fail_count > 0: if configure_fail_attr_count > 0:
sys.exit(-1) sys.exit(-1)
evt_subscriber_proxy.Start() evt_subscriber_proxy.Start()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment