diff --git a/rc/control/bookkeeping.py b/rc/control/bookkeeping.py index 99440e54..87dca914 100644 --- a/rc/control/bookkeeping.py +++ b/rc/control/bookkeeping.py @@ -1179,9 +1179,16 @@ def sends_to_via_RootNetOutput(proc1, proc2): return False + def art_analyzer_count(procinfo): + res = re.search(r"\s*art_analyzer_count\s*:\s*([0-9\.e]+)", procinfo.fhicl_used) + if res: + return int(float(res.group(1))) + return 1 + for subsystem_id, subsystem in self.subsystems.items(): init_fragment_counts = {} + broadcast_fragment_counts = {} for procinfo in [pi for pi in self.procinfos if pi.subsystem == subsystem_id]: @@ -1189,6 +1196,7 @@ def sends_to_via_RootNetOutput(proc1, proc2): possible_event_senders = [] init_fragment_count = 0 + broadcast_fragment_count = 0 if procinfo.name == "EventBuilder": for ss_source in subsystem.sources: @@ -1201,6 +1209,7 @@ def sends_to_via_RootNetOutput(proc1, proc2): possible_sender_procinfo, procinfo ): init_fragment_count += 1 + broadcast_fragment_count += art_analyzer_count(possible_sender_procinfo) elif procinfo.name == "DataLogger": for possible_sender_procinfo in [ pi @@ -1212,6 +1221,7 @@ def sends_to_via_RootNetOutput(proc1, proc2): possible_sender_procinfo, procinfo ): init_fragment_count += 1 + broadcast_fragment_count += art_analyzer_count(possible_sender_procinfo) elif procinfo.name == "Dispatcher": for possible_sender_procinfo in [ pi @@ -1223,6 +1233,7 @@ def sends_to_via_RootNetOutput(proc1, proc2): possible_sender_procinfo, procinfo ): init_fragment_count += 1 + broadcast_fragment_count += art_analyzer_count(possible_sender_procinfo) if ( init_fragment_count == 0 ): # Dispatcher will _always_ receive init Fragments, this probably means we're running without DataLoggers @@ -1236,8 +1247,10 @@ def sends_to_via_RootNetOutput(proc1, proc2): possible_sender_procinfo, procinfo ): init_fragment_count += 1 + broadcast_fragment_count += art_analyzer_count(possible_sender_procinfo) init_fragment_counts[procinfo.name] = init_fragment_count + broadcast_fragment_counts[procinfo.name] = broadcast_fragment_count procinfo.fhicl_used = re.sub( "init_fragment_count\s*:\s*\S+", @@ -1245,6 +1258,12 @@ def sends_to_via_RootNetOutput(proc1, proc2): procinfo.fhicl_used, ) + procinfo.fhicl_used = re.sub( + "broadcast_fragment_count\s*:\s*\S+", + "broadcast_fragment_count: %d" % broadcast_fragment_counts[procinfo.name], + procinfo.fhicl_used, + ) + def bookkeeping_for_fhicl_documents_artdaq_v4_base(self): pass diff --git a/rc/control/daqinterface.py b/rc/control/daqinterface.py index 9932ed5d..0cf594d4 100755 --- a/rc/control/daqinterface.py +++ b/rc/control/daqinterface.py @@ -51,6 +51,7 @@ from rc.control.utilities import reformat_fhicl_documents from rc.control.utilities import fhicl_writes_root_file from rc.control.utilities import get_setup_commands +from rc.control.utilities import get_build_info from rc.control.utilities import kill_tail_f from rc.control.utilities import obtain_messagefacility_fhicl from rc.control.utilities import record_directory_info @@ -66,8 +67,9 @@ messagefacility_fhicl_filename = obtain_messagefacility_fhicl(True) if ( - not "ARTDAQ_LOG_FHICL" in os.environ - #or os.environ["ARTDAQ_LOG_FHICL"] != messagefacility_fhicl_filename + not "ARTDAQ_LOG_FHICL" + in os.environ + # or os.environ["ARTDAQ_LOG_FHICL"] != messagefacility_fhicl_filename ): raise Exception( make_paragraph( @@ -868,7 +870,6 @@ def read_settings(self): self.record_directory = None self.package_hashes_to_save = [] self.package_versions = {} - self.productsdir_for_bash_scripts = None self.max_fragment_size_bytes = None self.boardreader_timeout = 30 @@ -892,7 +893,6 @@ def read_settings(self): self.max_num_launch_procs_checks = 20 self.launch_procs_wait_time = 40 - self.productsdir = None self.spackdir = None for line in inf.readlines(): @@ -912,11 +912,6 @@ def read_settings(self): self.log_directory = line.split()[-1].strip() elif "record_directory" in line or "record directory" in line: self.record_directory = line.split()[-1].strip() - elif ( - "productsdir_for_bash_scripts" in line - or "productsdir for bash scripts" in line - ): - self.productsdir = line.split()[-1].strip() elif ( "spack_root_for_bash_scripts" in line or "spack root for bash scripts" in line @@ -1106,11 +1101,17 @@ def read_settings(self): self.data_directory_override = self.data_directory_override + "/" elif "transfer_plugin_to_use" in line or "transfer plugin to use" in line: self.default_transfer = line.split()[-1].strip() - elif "transfer_plugin_from_brs" in line or "transfer plugin from brs" in line: + elif ( + "transfer_plugin_from_brs" in line or "transfer plugin from brs" in line + ): self.br_transfer = line.split()[-1].strip() - elif "transfer_plugin_from_ebs" in line or "transfer plugin from ebs" in line: + elif ( + "transfer_plugin_from_ebs" in line or "transfer plugin from ebs" in line + ): self.eb_transfer = line.split()[-1].strip() - elif "transfer_plugin_from_dls" in line or "transfer plugin from dls" in line: + elif ( + "transfer_plugin_from_dls" in line or "transfer plugin from dls" in line + ): self.dl_transfer = line.split()[-1].strip() elif "allowed_processors" in line or "allowed processors" in line: self.allowed_processors = line.split()[-1].strip() @@ -1138,8 +1139,8 @@ def read_settings(self): if self.record_directory is None: missing_vars.append("record_directory") - if self.productsdir is None and self.spackdir is None: - missing_vars.append("productsdir_for_bash_scripts or spack_root_for_bash_scripts") + if self.spackdir is None: + missing_vars.append("spack_root_for_bash_scripts") if not self.advanced_memory_usage and self.max_fragment_size_bytes is None: missing_vars.append("max_fragment_size_bytes") @@ -1303,11 +1304,9 @@ def have_artdaq_mfextensions(self): return self.artdaq_mfextensions_booleans[self.daq_setup_script] cmds = [] - cmds += get_setup_commands(self.productsdir, self.spackdir) + cmds += get_setup_commands(self.spackdir) cmds.append(". %s for_running" % (self.daq_setup_script)) - cmds.append( - 'type -P "msgviewer" && true || false' - ) + cmds.append('type -P "msgviewer" && true || false') checked_cmd = construct_checked_command(cmds) @@ -1326,33 +1325,6 @@ def have_artdaq_mfextensions(self): return self.artdaq_mfextensions_booleans[self.daq_setup_script] - def artdaq_mfextensions_info(self): - - assert self.have_artdaq_mfextensions() - - cmds = [] - cmds += get_setup_commands(self.productsdir, self.spackdir) - cmds.append(". %s for_running" % (self.daq_setup_script)) - cmds.append( - 'if [ -n "$SETUP_ARTDAQ_MFEXTENSIONS" ]; then printenv SETUP_ARTDAQ_MFEXTENSIONS; else echo "artdaq_mfextensions $ARTDAQ_MFEXTENSIONS_VERSION $MRB_QUALS";fi' - ) - - proc = Popen( - ";".join(cmds), - executable="/bin/bash", - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) - - proclines = proc.stdout.readlines() - - printenv_line = proclines[-1].decode("utf-8") - version = printenv_line.split()[1] - qualifiers = printenv_line.split()[-1] - - return (version, qualifiers) - # WK 8/31/21 # refactor out launching the message viewer into a function # and make that function run in the background @@ -1364,11 +1336,12 @@ def launch_msgviewer(self): self.partition_number, os.environ["USER"], ) - cmds += get_setup_commands(self.productsdir, self.spackdir) + cmds += get_setup_commands(self.spackdir) cmds.append(". %s for_running" % (self.daq_setup_script)) cmds.append("which msgviewer") cmds.append( - "cp `find ${FHICL_FILE_PATH//:/\/ } -name 'msgviewer.fcl' 2>/dev/null|head -1` %s" % (msgviewer_fhicl) + "cp `find ${FHICL_FILE_PATH//:/\/ } -name 'msgviewer.fcl' 2>/dev/null|head -1` %s" + % (msgviewer_fhicl) ) cmds.append( 'res=$( grep -l "port: %d" %s )' % (port_to_replace, msgviewer_fhicl) @@ -2020,7 +1993,10 @@ def softlink_logfiles(self): link_logfile_cmd = "; ".join(softlink_commands_to_run_on_host[host]) if not host_is_local(host): - link_logfile_cmd = "ssh -o BatchMode=yes %s '%s'" % (host, link_logfile_cmd) + link_logfile_cmd = "ssh -o BatchMode=yes %s '%s'" % ( + host, + link_logfile_cmd, + ) proc = Popen( link_logfile_cmd, @@ -2056,8 +2032,9 @@ def fill_package_versions(self, packages): if self.spackdir != None: cmd = ( - "%s ; . %s; spack find --loaded | sed -r -n 's/^(%s)@(\\S+).*/\\1 \\2/p'" % ( - ";".join(get_setup_commands(self.productsdir, self.spackdir)), + "%s ; . %s; spack find | sed -r -n 's/^(%s)@(\\S+).*/\\1 \\2/p'" + % ( + ";".join(get_setup_commands(self.spackdir)), self.daq_setup_script, "|".join(needed_packages), ) @@ -2618,12 +2595,10 @@ def archive_documents(self, labeled_fhicl_documents): 3, ) try: - self.procinfos[ - procinfo_index - ].lastreturned = self.procinfos[ - procinfo_index - ].server.daq.add_config_archive_entry( - label, contents + self.procinfos[procinfo_index].lastreturned = ( + self.procinfos[ + procinfo_index + ].server.daq.add_config_archive_entry(label, contents) ) except: self.print_log("d", traceback.format_exc(), 2) @@ -2775,37 +2750,9 @@ def create_setup_fhiclcpp_if_needed(self): ), ) with open(os.environ["DAQINTERFACE_SETUP_FHICLCPP"], "w") as outf: - outf.write("\n".join(get_setup_commands(self.productsdir, self.spackdir))) + outf.write("\n".join(get_setup_commands(self.spackdir))) outf.write("\n\n") - if self.productsdir != None: - lines = Popen( - '%s;ups list -aK+ fhiclcpp | sort -n' - % (";".join(get_setup_commands(self.productsdir, self.spackdir))), - executable="/bin/bash", - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ).stdout.readlines() - if len(lines) > 0: - fhiclcpp_to_setup_line = lines[-1].decode("utf-8") - else: - os.unlink(os.environ["DAQINTERFACE_SETUP_FHICLCPP"]) - raise Exception( - make_paragraph( - 'Unable to find fhiclcpp ups product in products directory "%s" provided in the DAQInterface settings file, "%s"' - % (self.productsdir, os.environ["DAQINTERFACE_SETTINGS"]) - ) - ) - - outf.write( - "setup %s %s -q %s\n" - % ( - fhiclcpp_to_setup_line.split()[0], - fhiclcpp_to_setup_line.split()[1], - fhiclcpp_to_setup_line.split()[3], - ) - ) - elif self.spackdir != None: + if self.spackdir != None: outf.write("spack load --first fhicl-cpp") if os.path.exists(os.environ["DAQINTERFACE_SETUP_FHICLCPP"]): @@ -3050,15 +2997,13 @@ def revert_failed_boot(failed_action): ) elif self.have_artdaq_mfextensions(): - version, qualifiers = self.artdaq_mfextensions_info() self.print_log( "i", make_paragraph( - "artdaq_mfextensions %s, %s, appears to be available; " + "artdaq_mfextensions appears to be available; " "if windowing is supported on your host you should see the " "messageviewer window pop up momentarily" - % (version, qualifiers) ), ) @@ -3116,7 +3061,7 @@ def revert_failed_boot(failed_action): # self.print_log("d", "\n", random_node_source_debug_level) cmd = "%s ; . %s for_running" % ( - ";".join(get_setup_commands(self.productsdir, self.spackdir)), + ";".join(get_setup_commands(self.spackdir)), self.daq_setup_script, ) @@ -3250,7 +3195,10 @@ def revert_failed_boot(failed_action): cmds = [] cmds.append( "if [[ -z $( command -v fhicl-dump ) ]]; then %s; source %s; fi" - % (";".join(get_setup_commands(self.productsdir, self.spackdir)), os.environ["DAQINTERFACE_SETUP_FHICLCPP"]) + % ( + ";".join(get_setup_commands(self.spackdir)), + os.environ["DAQINTERFACE_SETUP_FHICLCPP"], + ) ) cmds.append( "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): for procinfo in self.procinfos: if name in procinfo.name: - priorities_used[ - procinfo.priority - ] = "We only care about the key in the dict" + priorities_used[procinfo.priority] = ( + "We only care about the key in the dict" + ) for priority in sorted(priorities_used.keys(), reverse=True): for procinfo in self.procinfos: @@ -4345,27 +4293,13 @@ def send_recover_command(command): # transition "in the queue" despite DAQInterface being in the # Stopped state after we've finished this recover - self.__do_boot = ( - self.__do_shutdown - ) = ( - self.__do_config - ) = ( - self.__do_recover - ) = ( + self.__do_boot = self.__do_shutdown = self.__do_config = self.__do_recover = ( self.__do_start_running - ) = ( - self.__do_stop_running - ) = ( - self.__do_terminate - ) = ( - self.__do_pause_running - ) = ( + ) = self.__do_stop_running = self.__do_terminate = self.__do_pause_running = ( self.__do_resume_running - ) = ( - self.__do_enable - ) = ( - self.__do_disable - ) = self.do_trace_get_boolean = self.do_trace_set_boolean = False + ) = self.__do_enable = self.__do_disable = self.do_trace_get_boolean = ( + self.do_trace_set_boolean + ) = False self.complete_state_change(self.name, "recovering") @@ -4414,7 +4348,6 @@ def artdaq_process_info(self, name, quiet=False): # 5/30/14, called every 1s by control.py def runner(self): - """ Component "ops" loop. Called at threading hearbeat frequency, currently 1/sec. @@ -4625,7 +4558,7 @@ def main(): # no-coverage shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - encoding="UTF-8" + encoding="UTF-8", ) .stdout.readlines()[0] .strip() diff --git a/rc/control/manage_processes_direct.py b/rc/control/manage_processes_direct.py index 2884c8a6..27ae079d 100644 --- a/rc/control/manage_processes_direct.py +++ b/rc/control/manage_processes_direct.py @@ -208,7 +208,7 @@ def launch_procs_base(self): cmds = [] cmds.append( "if [[ -z $( command -v fhicl-dump ) ]]; then %s; source %s; fi" - % (";".join(get_setup_commands(self.productsdir, self.spackdir)), os.environ["DAQINTERFACE_SETUP_FHICLCPP"]) + % (";".join(get_setup_commands(self.spackdir)), os.environ["DAQINTERFACE_SETUP_FHICLCPP"]) ) cmds.append( "if [[ $FHICLCPP_VERSION =~ v4_1[01]|v4_0|v[0123] ]]; then dump_arg=0;else dump_arg=none;fi" @@ -310,7 +310,7 @@ def launch_procs_base(self): launch_commands_to_run_on_host[procinfo.host].append( "echo > %s" % (self.launch_attempt_files[procinfo.host]) ) - launch_commands_to_run_on_host[procinfo.host] += get_setup_commands(self.productsdir, self.spackdir,self.launch_attempt_files[procinfo.host]) + launch_commands_to_run_on_host[procinfo.host] += get_setup_commands(self.spackdir,self.launch_attempt_files[procinfo.host]) launch_commands_to_run_on_host[procinfo.host].append( "source %s for_running >> %s 2>&1 " % (self.daq_setup_script, self.launch_attempt_files[procinfo.host]) diff --git a/rc/control/save_run_record.py b/rc/control/save_run_record.py index feafb844..af8457ec 100644 --- a/rc/control/save_run_record.py +++ b/rc/control/save_run_record.py @@ -182,14 +182,10 @@ def save_run_record_base(self): "\n# \n\n" ) - assert "ARTDAQ_DAQINTERFACE_DIR" in os.environ and os.path.exists( - os.environ["ARTDAQ_DAQINTERFACE_DIR"] - ) - buildinfo_packages = [ pkg for pkg in self.package_hashes_to_save ] # Directly assigning would make buildinfo_packages a reference, not a copy - buildinfo_packages.append("artdaq_daqinterface") + buildinfo_packages.append("artdaq-daqinterface") package_buildinfo_dict = get_build_info(buildinfo_packages, self.daq_setup_script) @@ -207,19 +203,19 @@ def save_run_record_base(self): "%s" % ( get_commit_info( - "DAQInterface", os.environ["ARTDAQ_DAQINTERFACE_DIR"] + "DAQInterface", "%s/srcs/artdaq-daqinterface" % (self.daq_dir) ) ) ) except Exception: # Not an exception in a bad sense as the throw just means we're using DAQInterface as a ups product - self.fill_package_versions(["artdaq_daqinterface"]) + self.fill_package_versions(["artdaq-daqinterface"]) outf.write( "DAQInterface commit/version: %s" - % (self.package_versions["artdaq_daqinterface"]) + % (self.package_versions["artdaq-daqinterface"]) ) - outf.write(" %s\n\n" % (package_buildinfo_dict["artdaq_daqinterface"])) + outf.write(" %s\n\n" % (package_buildinfo_dict["artdaq-daqinterface"])) package_commit_dict = {} packages_whose_versions_we_need = [] diff --git a/rc/control/utilities.py b/rc/control/utilities.py index f64bc355..7f7d93e8 100755 --- a/rc/control/utilities.py +++ b/rc/control/utilities.py @@ -16,8 +16,6 @@ from threading import Thread -bash_unsetup_command = 'upsname=$( which ups 2>/dev/null ); if [[ -n $upsname ]]; then unsetup() { . `$upsname unsetup "$@"` ; }; for pp in `printenv | sed -ne "/^SETUP_/{s/SETUP_//;s/=.*//;p}"`; do test $pp = UPS && continue; prod=`echo $pp | tr "A-Z" "a-z"`; unsetup -j $prod; done; echo "After bash unsetup, products active (should be nothing but ups listed):"; ups active; else echo "ups does not appear to be set up; will not unsetup any products"; fi' - # Raise exceptions from threads https://stackoverflow.com/questions/2829329/catch-a-threads-exception-in-the-caller-thread class RaisingThread(Thread): def run(self): @@ -423,7 +421,7 @@ def construct_checked_command(cmds): checked_cmds.append(cmd) - if not re.search(r"\s*&\s*$", cmd) and not bash_unsetup_command in cmd: + if not re.search(r"\s*&\s*$", cmd): check_cmd = ( 'if [[ "$?" != "0" ]]; then echo %s: Nonzero return value from the following command: "%s" >> /tmp/daqinterface_checked_command_failures_%s.log; exit 1; fi ' % (date_and_time(), cmd, os.environ["USER"]) @@ -483,13 +481,11 @@ def reformat_fhicl_documents(setup_fhiclcpp, procinfos): "if [[ -z $( command -v fhicl-dump ) ]]; then source %s; fi" % (setup_fhiclcpp) ) - cmds.append( - "if [[ $FHICLCPP_VERSION =~ v4_1[01]|v4_0|v[0123] ]]; then dump_arg=0;else dump_arg=none;fi" - ) + cmds.append("cd %s" % (reformat_indir)) xargs_cmd = ( - "find ./ -name \*.fcl -print | xargs -I {} -n 1 -P %s fhicl-dump -l $dump_arg -c {} -o %s/{}" + "find ./ -name \*.fcl -print | xargs -I {} -n 1 -P %s fhicl-dump -l none -c {} -o %s/{}" % (nprocessors, reformat_outdir) ) @@ -668,7 +664,7 @@ def get_commit_info_filename(pkgname): def get_build_info(pkgnames, setup_script): def parse_buildinfo_file(buildinfo_filename): - + #print(f"Searching for verison/timestamp info in {buildinfo_filename}") buildinfo_version = '"version from BuildInfo undetermined"' buildinfo_time = '"time from BuildInfo undetermined"' @@ -700,12 +696,10 @@ def parse_buildinfo_file(buildinfo_filename): pkg_build_infos = {} cmds = [] - cmds.append(bash_unsetup_command) cmds.append(". %s" % (setup_script)) for pkgname in pkgnames: - ups_pkgname = pkgname.replace("-", "_") - cmds.append('ups active | grep -E "^%s\s+"' % (ups_pkgname)) + cmds.append(f'spack cd -i {pkgname};pwd') proc = Popen( ";".join(cmds), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding="UTF-8" @@ -716,71 +710,31 @@ def parse_buildinfo_file(buildinfo_filename): buildinfo_time = '"time from BuildInfo undetermined"' buildinfo_version = '"version from BuildInfo undetermined"' - pkg_build_infos[pkgname] = "%s %s" % (buildinfo_time, buildinfo_version) - - ups_pkgname = pkgname.replace("-", "_") + pkg_build_infos[pkgname] = f"{buildinfo_time} {buildinfo_version}" - found_ups_package = False + found_spack_package = False package_line_number = -1 for i_l, line in enumerate(stdoutlines): - if re.search(r"^%s\s+" % (ups_pkgname), line): - found_ups_package = True + if re.search(rf"/{pkgname}-v?[0-9]", line): + found_spack_package = True package_line_number = i_l break - if found_ups_package: - version = stdoutlines[package_line_number].split()[1] - upsdir = stdoutlines[package_line_number].split()[-1] + if found_spack_package: + package_dir = stdoutlines[package_line_number] - ups_sourcedir = "%s/%s/%s/source" % (upsdir, ups_pkgname, version) - - if not os.path.exists(ups_sourcedir): - # print "Unable to find expected ups source file directory %s, will not be able to save build info for %s in the run record" % (ups_sourcedir, pkgname) - continue - - buildinfo_file1 = "%s/%s/BuildInfo/GetPackageBuildInfo.cc" % ( - ups_sourcedir, - pkgname, - ) - buildinfo_file2 = "%s/%s/BuildInfo/GetPackageBuildInfo.cc" % ( - ups_sourcedir, - pkgname.replace("_", "-"), - ) - if os.path.exists(buildinfo_file1): - buildinfo_file = buildinfo_file1 - elif os.path.exists(buildinfo_file2): - buildinfo_file = buildinfo_file2 - else: - if buildinfo_file1 != buildinfo_file2: - print( - "Unable to find hoped-for %s BuildInfo file (%s or %s), will not be able to save build info for %s in the run record" - % (pkgname, buildinfo_file1, buildinfo_file2, pkgname) - ) - else: - print( - "Unable to find hoped-for %s BuildInfo file (%s), will not be able to save build info for %s in the run record" - % (pkgname, buildinfo_file1, pkgname) - ) - - continue + buildinfo_file = f"{package_dir}/source/{pkgname}/BuildInfo/GetPackageBuildInfo.cc" pkg_build_infos[pkgname] = parse_buildinfo_file(buildinfo_file) continue else: - mrb_basedir = os.path.dirname(setup_script) - # print "No ups product for %s is set up by %s, will check for build info in local build subdirectory of %s" % (pkgname, setup_script, mrb_basedir) - builddir_as_list = [ - builddir - for builddir in os.listdir(os.path.dirname(setup_script)) - if re.search(r"build_.*\..*", builddir) - ] - - if len(builddir_as_list) == 1: - builddir = builddir_as_list[0] + mpd_basedir = os.path.dirname(setup_script) + + if os.path.exists(mpd_basedir + "/build"): desired_file = "%s/%s/%s/%s/BuildInfo/GetPackageBuildInfo.cc" % ( - mrb_basedir, - builddir, - pkgname.replace("-", "_"), + mpd_basedir, + "build", + pkgname, pkgname, ) if os.path.exists(desired_file): @@ -789,14 +743,8 @@ def parse_buildinfo_file(buildinfo_filename): # print "Unable to find a file with the name %s, will not be able to save build info for %s in the run record" % (desired_file, pkgname) pass - elif len(builddir_as_list) > 1: - print( - "Warning: unable to find build info for %s as %s doesn't set up a ups product for it and there's more than one local build subdirectory in %s: %s" - % (pkgname, setup_script, mrb_basedir, " ".join(builddir_as_list)) - ) - pass else: - # print "No local build subdirectory was found in %s, no build info for %s will be saved in the run record" % (mrb_basedir, pkgname) + print( "No local build subdirectory was found in %s, no build info for %s will be saved in the run record" % (mpd_basedir, pkgname)) pass return pkg_build_infos @@ -953,22 +901,6 @@ def zero_out_last_subnet(network): assert res, 'Developer error: proper address not passed to "zero_out_last_subnet"' return "%s0" % (res.group(1)) - -def upsproddir_from_productsdir(productsdir): - for pp in productsdir.split(":"): - upsproddir = "" # may not find what we're looking for - tt = pp.rstrip("/") + "/" # make sure it ends with _single_ '/' - if ( - os.path.isdir(tt) - and os.path.isfile(tt + "setup") - and os.path.isdir(tt + ".upsfiles") - and os.path.isdir(tt + "ups") - ): - upsproddir = pp.rstrip("/") # make sure it does not end with '/' - break - return upsproddir - - def record_directory_info(recorddir): if not os.path.exists(recorddir): raise Exception('Directory "%s" doesn\'t exist, exiting...') @@ -1032,18 +964,6 @@ def main(): sys.exit(0) - elif len(sys.argv) > 1 and sys.argv[1] == "upsproddir_from_productsdir": - if len(sys.argv) != 3: - print( - make_paragraph( - "Error: expected 1 argument to upsproddir_from_productsdir: PRODUCTS_list" - ) - ) - sys.exit(1) - - productsdir = sys.argv[2] - print(upsproddir_from_productsdir(productsdir)) - sys.exit(0) elif len(sys.argv) > 1 and sys.argv[1] == "record_directory_info": if len(sys.argv) != 3: print( @@ -1129,9 +1049,6 @@ def main(): print(outputstring) print - if bash_unsetup_test: - Popen(bash_unsetup_command, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - if get_commit_info_test: pkgname = "artdaq" gitrepo = "/home/jcfree/artdaq-demo_v3_04_01/srcs/artdaq" @@ -1221,30 +1138,9 @@ def main(): print('Name of table enclosing "%s" found to be "%s"' % (token, tablename)) -def get_setup_commands(productsdir=None, spackdir=None, log_file=None): +def get_setup_commands(spackdir=None, log_file=None): output = [] - if productsdir != None: - if log_file == None: - output.append( - 'export PRODUCTS="%s"; . %s/setup' - % ( - productsdir, - upsproddir_from_productsdir(productsdir), - ) - ) - else: - output.append( - 'export PRODUCTS="%s"; . %s/setup >> %s 2>&1 ' - % ( - productsdir, - upsproddir_from_productsdir(productsdir), - log_file, - ) - ) - output.append( - bash_unsetup_command + " > /dev/null 2>&1 " - ) - elif spackdir != None: + if spackdir != None: output.append("export SPACK_DISABLE_LOCAL_CONFIG=true") if log_file == None: output.append('. %s/share/spack/setup-env.sh' % (spackdir))