Skip to content
Snippets Groups Projects
Commit 0dacb360 authored by BRONES Romain's avatar BRONES Romain
Browse files

Integrate latest fixes

parents 3923503c e70142b6
No related branches found
No related tags found
No related merge requests found
...@@ -53,17 +53,27 @@ def init_watcher(): ...@@ -53,17 +53,27 @@ def init_watcher():
Run init on Fofb-Watcher, waiting for its completion then init on the FofbCommand. Run init on Fofb-Watcher, waiting for its completion then init on the FofbCommand.
""" """
wprx=tango.DeviceProxy(tangopath["fofb-watcher"]) try:
wprx.set_timeout_millis(30000) wprx=tango.DeviceProxy(tangopath["fofb-watcher"])
wprx.set_timeout_millis(30000)
except tango.DevFailed as e:
logger.error("Could not get DeviceProxy on {}".format(tangopath["fofb-watcher"]))
logger.debug(str(e))
return
logger.info("Perform init() on Fofb-Watcher. This takes nearly a minute.") logger.info("Perform init() on Fofb-Watcher. This takes nearly a minute.")
try: try:
wprx.init() wprx.init()
except tango.DevFailed as e: except tango.DevFailed as e:
logger.error("Could not perform init() on Fofb-Watcher.") logger.error("Could not perform init() on Fofb-Watcher.")
logger.debug(str(e))
logger.info("Perform init() on Fofb-Command.") logger.info("Perform init() on Fofb-Command.")
tango.DeviceProxy(tangopath["fofb-command"]).init() try:
tango.DeviceProxy(tangopath["fofb-command"]).init()
except tango.DevFailed as e:
logger.error("Could not perform init() on '{}', got DevFailed.".format(tangopath['fofb-command']))
logger.debug(str(e))
def confds_opcua(): def confds_opcua():
""" """
......
...@@ -32,7 +32,10 @@ if __name__ == '__main__': ...@@ -32,7 +32,10 @@ if __name__ == '__main__':
parser.add_argument("--log", default="info", parser.add_argument("--log", default="info",
help="Log level (error, warning, info, debug)") help="Log level (error, warning, info, debug)")
parser.add_argument("--conf-file", type=str, parser.add_argument("--force", action="store_true",
help="Force operation even if FOFB is running.")
parser.add_argument("--fileconfig", type=str,
help="Path to config file to apply.") help="Path to config file to apply.")
parser.add_argument("--DS-init-opcua", action="store_true", parser.add_argument("--DS-init-opcua", action="store_true",
...@@ -49,9 +52,10 @@ if __name__ == '__main__': ...@@ -49,9 +52,10 @@ if __name__ == '__main__':
parser.add_argument("--stop-ccn", action="store_true", parser.add_argument("--stop-ccn", action="store_true",
help="Stop command for the ComBPM applications blocks.") help="Stop command for the ComBPM applications blocks.")
parser.add_argument("--configure", choices=["combpm", "ccn", "comcorr", "corr", "all", "every"], nargs="+", parser.add_argument("--configure", choices=["combpm", "ccn", "comcorr", "corr", "all", "every"],
nargs='?', const='all',
help="Configuration commands for the Fofb applications blocs."+ help="Configuration commands for the Fofb applications blocs."+
" 'all' is for all com, not configuring corrector. 'every' configure everything.") " 'all' is for all com, not configuring corrector. 'every' configure everything. Default is 'all'")
parser.add_argument("--start", action="store_true", parser.add_argument("--start", action="store_true",
help="Start command for the CCN and ComBPM applications blocks.") help="Start command for the CCN and ComBPM applications blocks.")
...@@ -68,10 +72,19 @@ if __name__ == '__main__': ...@@ -68,10 +72,19 @@ if __name__ == '__main__':
logger.debug(args) logger.debug(args)
if "conf_file" in args: if not args.fileconfig is None:
FofbTool.Configuration.loadconfig(args.conf_file) FofbTool.Configuration.loadconfig(args.fileconfig)
FofbTool.Configuration.logdebugconf() FofbTool.Configuration.logdebugconf()
## Check running
if not FofbTool.Utils.check_fofbnotrunning():
logger.warning("FOFB is running")
if not args.force:
logger.warning("Stoping here")
exit(1)
else:
logger.warning("Action forced")
## Device Server related commands ## Device Server related commands
if args.DS_init_opcua: if args.DS_init_opcua:
FofbTool.Utils.init_opcua() FofbTool.Utils.init_opcua()
...@@ -87,16 +100,14 @@ if __name__ == '__main__': ...@@ -87,16 +100,14 @@ if __name__ == '__main__':
if args.stop or args.stop_ccn: if args.stop or args.stop_ccn:
FofbTool.Utils.stop_all_ccn() FofbTool.Utils.stop_all_ccn()
if not args.configure is None: if args.configure in ("combpm", "all", "every"):
for conf in args.configure: FofbTool.Utils.conf_all_combpm()
if conf in ("combpm", "all", "every"): if args.configure in ("comcorr", "all", "every"):
FofbTool.Utils.conf_all_combpm() FofbTool.Utils.conf_all_comcorr()
if conf in ("comcorr", "all", "every"): if args.configure in ("ccn", "all", "every"):
FofbTool.Utils.conf_all_comcorr() FofbTool.Utils.conf_all_ccn()
if conf in ("ccn", "all", "every"): if args.configure in ("corr", "every"):
FofbTool.Utils.conf_all_ccn() FofbTool.Configuration.centralnode_configure_corr()
if conf in ("corr", "every"):
FofbTool.Configuration.centralnode_configure_corr()
if args.start or args.start_combpm: if args.start or args.start_combpm:
FofbTool.Utils.start_all_combpm() FofbTool.Utils.start_all_combpm()
......
...@@ -9,7 +9,7 @@ cp FofbTool/*.py $ipath/ -rvf ...@@ -9,7 +9,7 @@ cp FofbTool/*.py $ipath/ -rvf
cp FofbTool/*.cfg $ipath/ -rvf cp FofbTool/*.cfg $ipath/ -rvf
# Copy bin CLI # Copy bin CLI
cp bin/FofbTool ~/bin/ -vf cp bin/FofbTool /home/production/scripts/DG/python/bin/ -vf
# Put exec rights # Put exec rights
chmod +x ~/bin/FofbTool chmod +x /home/production/scripts/DG/python/bin/FofbTool
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment