5151from rc .control .utilities import reformat_fhicl_documents
5252from rc .control .utilities import fhicl_writes_root_file
5353from rc .control .utilities import get_setup_commands
54+ from rc .control .utilities import get_build_info
5455from rc .control .utilities import kill_tail_f
5556from rc .control .utilities import obtain_messagefacility_fhicl
5657from rc .control .utilities import record_directory_info
6667
6768 messagefacility_fhicl_filename = obtain_messagefacility_fhicl (True )
6869 if (
69- not "ARTDAQ_LOG_FHICL" in os .environ
70- #or os.environ["ARTDAQ_LOG_FHICL"] != messagefacility_fhicl_filename
70+ not "ARTDAQ_LOG_FHICL"
71+ in os .environ
72+ # or os.environ["ARTDAQ_LOG_FHICL"] != messagefacility_fhicl_filename
7173 ):
7274 raise Exception (
7375 make_paragraph (
@@ -868,7 +870,6 @@ def read_settings(self):
868870 self .record_directory = None
869871 self .package_hashes_to_save = []
870872 self .package_versions = {}
871- self .productsdir_for_bash_scripts = None
872873 self .max_fragment_size_bytes = None
873874
874875 self .boardreader_timeout = 30
@@ -892,7 +893,6 @@ def read_settings(self):
892893 self .max_num_launch_procs_checks = 20
893894 self .launch_procs_wait_time = 40
894895
895- self .productsdir = None
896896 self .spackdir = None
897897
898898 for line in inf .readlines ():
@@ -912,11 +912,6 @@ def read_settings(self):
912912 self .log_directory = line .split ()[- 1 ].strip ()
913913 elif "record_directory" in line or "record directory" in line :
914914 self .record_directory = line .split ()[- 1 ].strip ()
915- elif (
916- "productsdir_for_bash_scripts" in line
917- or "productsdir for bash scripts" in line
918- ):
919- self .productsdir = line .split ()[- 1 ].strip ()
920915 elif (
921916 "spack_root_for_bash_scripts" in line
922917 or "spack root for bash scripts" in line
@@ -1106,11 +1101,17 @@ def read_settings(self):
11061101 self .data_directory_override = self .data_directory_override + "/"
11071102 elif "transfer_plugin_to_use" in line or "transfer plugin to use" in line :
11081103 self .default_transfer = line .split ()[- 1 ].strip ()
1109- elif "transfer_plugin_from_brs" in line or "transfer plugin from brs" in line :
1104+ elif (
1105+ "transfer_plugin_from_brs" in line or "transfer plugin from brs" in line
1106+ ):
11101107 self .br_transfer = line .split ()[- 1 ].strip ()
1111- elif "transfer_plugin_from_ebs" in line or "transfer plugin from ebs" in line :
1108+ elif (
1109+ "transfer_plugin_from_ebs" in line or "transfer plugin from ebs" in line
1110+ ):
11121111 self .eb_transfer = line .split ()[- 1 ].strip ()
1113- elif "transfer_plugin_from_dls" in line or "transfer plugin from dls" in line :
1112+ elif (
1113+ "transfer_plugin_from_dls" in line or "transfer plugin from dls" in line
1114+ ):
11141115 self .dl_transfer = line .split ()[- 1 ].strip ()
11151116 elif "allowed_processors" in line or "allowed processors" in line :
11161117 self .allowed_processors = line .split ()[- 1 ].strip ()
@@ -1138,8 +1139,8 @@ def read_settings(self):
11381139 if self .record_directory is None :
11391140 missing_vars .append ("record_directory" )
11401141
1141- if self .productsdir is None and self . spackdir is None :
1142- missing_vars .append ("productsdir_for_bash_scripts or spack_root_for_bash_scripts" )
1142+ if self .spackdir is None :
1143+ missing_vars .append ("spack_root_for_bash_scripts" )
11431144
11441145 if not self .advanced_memory_usage and self .max_fragment_size_bytes is None :
11451146 missing_vars .append ("max_fragment_size_bytes" )
@@ -1303,11 +1304,9 @@ def have_artdaq_mfextensions(self):
13031304 return self .artdaq_mfextensions_booleans [self .daq_setup_script ]
13041305
13051306 cmds = []
1306- cmds += get_setup_commands (self .productsdir , self . spackdir )
1307+ cmds += get_setup_commands (self .spackdir )
13071308 cmds .append (". %s for_running" % (self .daq_setup_script ))
1308- cmds .append (
1309- 'type -P "msgviewer" && true || false'
1310- )
1309+ cmds .append ('type -P "msgviewer" && true || false' )
13111310
13121311 checked_cmd = construct_checked_command (cmds )
13131312
@@ -1326,33 +1325,6 @@ def have_artdaq_mfextensions(self):
13261325
13271326 return self .artdaq_mfextensions_booleans [self .daq_setup_script ]
13281327
1329- def artdaq_mfextensions_info (self ):
1330-
1331- assert self .have_artdaq_mfextensions ()
1332-
1333- cmds = []
1334- cmds += get_setup_commands (self .productsdir , self .spackdir )
1335- cmds .append (". %s for_running" % (self .daq_setup_script ))
1336- cmds .append (
1337- 'if [ -n "$SETUP_ARTDAQ_MFEXTENSIONS" ]; then printenv SETUP_ARTDAQ_MFEXTENSIONS; else echo "artdaq_mfextensions $ARTDAQ_MFEXTENSIONS_VERSION $MRB_QUALS";fi'
1338- )
1339-
1340- proc = Popen (
1341- ";" .join (cmds ),
1342- executable = "/bin/bash" ,
1343- shell = True ,
1344- stdout = subprocess .PIPE ,
1345- stderr = subprocess .STDOUT ,
1346- )
1347-
1348- proclines = proc .stdout .readlines ()
1349-
1350- printenv_line = proclines [- 1 ].decode ("utf-8" )
1351- version = printenv_line .split ()[1 ]
1352- qualifiers = printenv_line .split ()[- 1 ]
1353-
1354- return (version , qualifiers )
1355-
13561328 # WK 8/31/21
13571329 # refactor out launching the message viewer into a function
13581330 # and make that function run in the background
@@ -1364,11 +1336,12 @@ def launch_msgviewer(self):
13641336 self .partition_number ,
13651337 os .environ ["USER" ],
13661338 )
1367- cmds += get_setup_commands (self .productsdir , self . spackdir )
1339+ cmds += get_setup_commands (self .spackdir )
13681340 cmds .append (". %s for_running" % (self .daq_setup_script ))
13691341 cmds .append ("which msgviewer" )
13701342 cmds .append (
1371- "cp `find ${FHICL_FILE_PATH//:/\/ } -name 'msgviewer.fcl' 2>/dev/null|head -1` %s" % (msgviewer_fhicl )
1343+ "cp `find ${FHICL_FILE_PATH//:/\/ } -name 'msgviewer.fcl' 2>/dev/null|head -1` %s"
1344+ % (msgviewer_fhicl )
13721345 )
13731346 cmds .append (
13741347 'res=$( grep -l "port: %d" %s )' % (port_to_replace , msgviewer_fhicl )
@@ -2020,7 +1993,10 @@ def softlink_logfiles(self):
20201993 link_logfile_cmd = "; " .join (softlink_commands_to_run_on_host [host ])
20211994
20221995 if not host_is_local (host ):
2023- link_logfile_cmd = "ssh -o BatchMode=yes %s '%s'" % (host , link_logfile_cmd )
1996+ link_logfile_cmd = "ssh -o BatchMode=yes %s '%s'" % (
1997+ host ,
1998+ link_logfile_cmd ,
1999+ )
20242000
20252001 proc = Popen (
20262002 link_logfile_cmd ,
@@ -2056,8 +2032,9 @@ def fill_package_versions(self, packages):
20562032
20572033 if self .spackdir != None :
20582034 cmd = (
2059- "%s ; . %s; spack find --loaded | sed -r -n 's/^(%s)@(\\ S+).*/\\ 1 \\ 2/p'" % (
2060- ";" .join (get_setup_commands (self .productsdir , self .spackdir )),
2035+ "%s ; . %s; spack find | sed -r -n 's/^(%s)@(\\ S+).*/\\ 1 \\ 2/p'"
2036+ % (
2037+ ";" .join (get_setup_commands (self .spackdir )),
20612038 self .daq_setup_script ,
20622039 "|" .join (needed_packages ),
20632040 )
@@ -2618,12 +2595,10 @@ def archive_documents(self, labeled_fhicl_documents):
26182595 3 ,
26192596 )
26202597 try :
2621- self .procinfos [
2622- procinfo_index
2623- ].lastreturned = self .procinfos [
2624- procinfo_index
2625- ].server .daq .add_config_archive_entry (
2626- label , contents
2598+ self .procinfos [procinfo_index ].lastreturned = (
2599+ self .procinfos [
2600+ procinfo_index
2601+ ].server .daq .add_config_archive_entry (label , contents )
26272602 )
26282603 except :
26292604 self .print_log ("d" , traceback .format_exc (), 2 )
@@ -2775,37 +2750,9 @@ def create_setup_fhiclcpp_if_needed(self):
27752750 ),
27762751 )
27772752 with open (os .environ ["DAQINTERFACE_SETUP_FHICLCPP" ], "w" ) as outf :
2778- outf .write ("\n " .join (get_setup_commands (self .productsdir , self . spackdir )))
2753+ outf .write ("\n " .join (get_setup_commands (self .spackdir )))
27792754 outf .write ("\n \n " )
2780- if self .productsdir != None :
2781- lines = Popen (
2782- '%s;ups list -aK+ fhiclcpp | sort -n'
2783- % (";" .join (get_setup_commands (self .productsdir , self .spackdir ))),
2784- executable = "/bin/bash" ,
2785- shell = True ,
2786- stdout = subprocess .PIPE ,
2787- stderr = subprocess .STDOUT ,
2788- ).stdout .readlines ()
2789- if len (lines ) > 0 :
2790- fhiclcpp_to_setup_line = lines [- 1 ].decode ("utf-8" )
2791- else :
2792- os .unlink (os .environ ["DAQINTERFACE_SETUP_FHICLCPP" ])
2793- raise Exception (
2794- make_paragraph (
2795- 'Unable to find fhiclcpp ups product in products directory "%s" provided in the DAQInterface settings file, "%s"'
2796- % (self .productsdir , os .environ ["DAQINTERFACE_SETTINGS" ])
2797- )
2798- )
2799-
2800- outf .write (
2801- "setup %s %s -q %s\n "
2802- % (
2803- fhiclcpp_to_setup_line .split ()[0 ],
2804- fhiclcpp_to_setup_line .split ()[1 ],
2805- fhiclcpp_to_setup_line .split ()[3 ],
2806- )
2807- )
2808- elif self .spackdir != None :
2755+ if self .spackdir != None :
28092756 outf .write ("spack load --first fhicl-cpp" )
28102757
28112758 if os .path .exists (os .environ ["DAQINTERFACE_SETUP_FHICLCPP" ]):
@@ -3050,15 +2997,13 @@ def revert_failed_boot(failed_action):
30502997 )
30512998
30522999 elif self .have_artdaq_mfextensions ():
3053- version , qualifiers = self .artdaq_mfextensions_info ()
30543000
30553001 self .print_log (
30563002 "i" ,
30573003 make_paragraph (
3058- "artdaq_mfextensions %s, %s, appears to be available; "
3004+ "artdaq_mfextensions appears to be available; "
30593005 "if windowing is supported on your host you should see the "
30603006 "messageviewer window pop up momentarily"
3061- % (version , qualifiers )
30623007 ),
30633008 )
30643009
@@ -3116,7 +3061,7 @@ def revert_failed_boot(failed_action):
31163061 # self.print_log("d", "\n", random_node_source_debug_level)
31173062
31183063 cmd = "%s ; . %s for_running" % (
3119- ";" .join (get_setup_commands (self .productsdir , self . spackdir )),
3064+ ";" .join (get_setup_commands (self .spackdir )),
31203065 self .daq_setup_script ,
31213066 )
31223067
@@ -3250,7 +3195,10 @@ def revert_failed_boot(failed_action):
32503195 cmds = []
32513196 cmds .append (
32523197 "if [[ -z $( command -v fhicl-dump ) ]]; then %s; source %s; fi"
3253- % (";" .join (get_setup_commands (self .productsdir , self .spackdir )), os .environ ["DAQINTERFACE_SETUP_FHICLCPP" ])
3198+ % (
3199+ ";" .join (get_setup_commands (self .spackdir )),
3200+ os .environ ["DAQINTERFACE_SETUP_FHICLCPP" ],
3201+ )
32543202 )
32553203 cmds .append (
32563204 "if [[ $FHICLCPP_VERSION =~ v4_1[01]|v4_0|v[0123] ]]; then dump_arg=0;else dump_arg=none;fi"
@@ -4302,9 +4250,9 @@ def send_recover_command(command):
43024250
43034251 for procinfo in self .procinfos :
43044252 if name in procinfo .name :
4305- priorities_used [
4306- procinfo . priority
4307- ] = "We only care about the key in the dict"
4253+ priorities_used [procinfo . priority ] = (
4254+ "We only care about the key in the dict"
4255+ )
43084256
43094257 for priority in sorted (priorities_used .keys (), reverse = True ):
43104258 for procinfo in self .procinfos :
@@ -4345,27 +4293,13 @@ def send_recover_command(command):
43454293 # transition "in the queue" despite DAQInterface being in the
43464294 # Stopped state after we've finished this recover
43474295
4348- self .__do_boot = (
4349- self .__do_shutdown
4350- ) = (
4351- self .__do_config
4352- ) = (
4353- self .__do_recover
4354- ) = (
4296+ self .__do_boot = self .__do_shutdown = self .__do_config = self .__do_recover = (
43554297 self .__do_start_running
4356- ) = (
4357- self .__do_stop_running
4358- ) = (
4359- self .__do_terminate
4360- ) = (
4361- self .__do_pause_running
4362- ) = (
4298+ ) = self .__do_stop_running = self .__do_terminate = self .__do_pause_running = (
43634299 self .__do_resume_running
4364- ) = (
4365- self .__do_enable
4366- ) = (
4367- self .__do_disable
4368- ) = self .do_trace_get_boolean = self .do_trace_set_boolean = False
4300+ ) = self .__do_enable = self .__do_disable = self .do_trace_get_boolean = (
4301+ self .do_trace_set_boolean
4302+ ) = False
43694303
43704304 self .complete_state_change (self .name , "recovering" )
43714305
@@ -4414,7 +4348,6 @@ def artdaq_process_info(self, name, quiet=False):
44144348 # 5/30/14, called every 1s by control.py
44154349
44164350 def runner (self ):
4417-
44184351 """
44194352 Component "ops" loop. Called at threading hearbeat frequency,
44204353 currently 1/sec.
@@ -4625,7 +4558,7 @@ def main(): # no-coverage
46254558 shell = True ,
46264559 stdout = subprocess .PIPE ,
46274560 stderr = subprocess .STDOUT ,
4628- encoding = "UTF-8"
4561+ encoding = "UTF-8" ,
46294562 )
46304563 .stdout .readlines ()[0 ]
46314564 .strip ()
0 commit comments