Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 9, 2023
1 parent 7570727 commit 6642ac1
Show file tree
Hide file tree
Showing 45 changed files with 48 additions and 73 deletions.
3 changes: 1 addition & 2 deletions build/ReleaseManager/ReleaseManagerLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def __init__(self, rel, python_version, use_mock=True):
"_binary_filedigest_algorithm": "md5",
#'global __python': '%%{__python2}',
#'py_byte_compile': '',
#%py_byte_compile %{__python2} %{buildroot}%{_datadir}/mypackage/foo
# %py_byte_compile %{__python2} %{buildroot}%{_datadir}/mypackage/foo
}

# __init__
Expand Down Expand Up @@ -394,7 +394,6 @@ def execute(self):

class PackageExcludes:
def __init__(self):

self.commonPattern = [
"CVS",
".DS_Store",
Expand Down
2 changes: 1 addition & 1 deletion creation/lib/cWDictFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ def __init__(self, monitor_dir, work_dir, work_subdir="monitor", monitordir_name
#
################################################


# helper class, used below
class fileCommonDicts:
def __init__(self):
Expand Down Expand Up @@ -2237,7 +2238,6 @@ def erase(self, destroy_old_subs=True): # if false, the sub names will be prese
return

def load(self, destroy_old_subs=True): # if false, overwrite the subs you load, but leave the others as they are

self.main_dicts.load()
if destroy_old_subs:
self.sub_list = []
Expand Down
2 changes: 2 additions & 0 deletions creation/lib/cgWDictFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def is_equal(
#
################################################


# internal, do not use from outside the module
def get_common_dicts(submit_dir, stage_dir):
common_dicts = {
Expand Down Expand Up @@ -266,6 +267,7 @@ def get_entry_dicts(entry_submit_dir, entry_stage_dir, entry_name):
#
################################################


# internal, do not use from outside the module
def load_common_dicts(dicts, description_el): # update in place
# first submit dir ones (mutable)
Expand Down
4 changes: 2 additions & 2 deletions creation/lib/cgWParamDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def sortit(self, unsorted_dict):
i = i + 1
temp_list = sorted((x[1][1], x[0]) for x in list(d.items()))
sortedList = []
for (tmp, key) in temp_list:
for tmp, key in temp_list:
sortedList.append(d[key][0])
return sortedList

Expand All @@ -946,6 +946,7 @@ def new_SubDicts(self, sub_name):
#
############################################################


#############################################
# Add a user file residing in the stage area
# file as described by Params.file_defaults
Expand Down Expand Up @@ -1118,7 +1119,6 @@ def iter_to_dict(dictObject):
def populate_factory_descript(
work_dir, glidein_dict, active_sub_list, disabled_sub_list, conf # will be modified # will be modified
):

down_fname = os.path.join(work_dir, "glideinWMS.downtimes")

sec_el = conf.get_child("security")
Expand Down
1 change: 1 addition & 0 deletions creation/lib/cgWParams.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ def get_xml_format(self):
#
############################################################


#####################################
# try to find out the base condor dir
def find_condor_base_dir():
Expand Down
2 changes: 1 addition & 1 deletion creation/lib/cvWCreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_client_mapfile(mapfile_fname, my_DN, factory_DNs, schedd_DNs, collect
with open(mapfile_fname, "w") as fd:
if my_DN:
fd.write('GSI "^{}$" {}\n'.format(re.escape(my_DN), "me"))
for (uid, dns) in (
for uid, dns in (
("factory", factory_DNs),
("schedd", schedd_DNs),
("collector", collector_DNs),
Expand Down
2 changes: 2 additions & 0 deletions creation/lib/cvWDictFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def parse_val(self, line):
#
################################################


# internal, do not use from outside the module
def get_common_dicts(work_dir, stage_dir, simple_work_dir): # if True, do not create params
common_dicts = {
Expand Down Expand Up @@ -148,6 +149,7 @@ def get_group_dicts(group_work_dir, group_stage_dir, group_name, simple_work_dir
#
################################################


# internal, do not use from outside the module
def load_common_dicts(dicts, description_el): # update in place
# first work dir ones (mutable)
Expand Down
4 changes: 1 addition & 3 deletions creation/lib/cvWParamDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def new_SubDicts(self, sub_name):
#
############################################################


#######################
# Register an attribute
# attr_obj as described by Params.attr_defaults
Expand Down Expand Up @@ -833,7 +834,6 @@ def add_attr_unparsed_real(attr_name, params, dicts):
###################################
# Create the frontend descript file
def populate_frontend_descript(work_dir, frontend_dict, active_sub_list, params): # will be modified

frontend_dict.add("DowntimesFile", params.downtimes_file)
frontend_dict.add("FrontendName", params.frontend_name)
frontend_dict.add("WebURL", params.web_url)
Expand Down Expand Up @@ -891,7 +891,6 @@ def populate_frontend_descript(work_dir, frontend_dict, active_sub_list, params)
#######################
# Populate group descript
def populate_group_descript(work_dir, group_descript_dict, sub_name, sub_params): # will be modified

group_descript_dict.add("GroupName", sub_name)

group_descript_dict.add("MapFile", os.path.join(work_dir, cvWConsts.GROUP_MAP_FILE))
Expand Down Expand Up @@ -923,7 +922,6 @@ def populate_group_descript(work_dir, group_descript_dict, sub_name, sub_params)


def apply_group_singularity_policy(descript_dict, sub_params, params):

glidein_singularity_use = None
query_expr = descript_dict["FactoryQueryExpr"]
match_expr = descript_dict["MatchExpr"]
Expand Down
1 change: 1 addition & 0 deletions creation/lib/cvWParams.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ def update_match_attrs(self):
# Use the class method instead
####################################################################


# return attribute value in the proper python format
def extract_attr_val(attr_obj):
if not attr_obj.type in ("string", "int", "expr"):
Expand Down
1 change: 0 additions & 1 deletion factory/glideFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ def generate_log_tokens(startup_dir, glideinDescript):

# Issue a token for each entry-recipient pair
for entry in entries:

# Get the list of recipients
if "LOG_RECIPIENTS_FACTORY" in glideFactoryConfig.JobParams(entry).data:
log_recipients = glideFactoryConfig.JobParams(entry).data["LOG_RECIPIENTS_FACTORY"].split()
Expand Down
1 change: 1 addition & 0 deletions factory/glideFactoryConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self):
#
############################################################


# loads a file composed of
# NAME VAL
# and creates
Expand Down
3 changes: 1 addition & 2 deletions factory/glideFactoryEntry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,6 @@ def unit_work_v3(
)

if entry.isSecurityClassInDowntime(client_security_name, credential_security_class):

# Cannot use proxy for submission but entry is not in downtime
# since other proxies may map to valid security classes
entry.log.warning(
Expand Down Expand Up @@ -1851,7 +1850,6 @@ def update_entries_stats(factory_in_downtime, entry_list):

updated_entries = []
for entry in entry_list:

# Add a heuristic to improve efficiency. Skip if no changes in the entry
# if nothing_to_do:
# continue
Expand Down Expand Up @@ -1904,6 +1902,7 @@ def update_entries_stats(factory_in_downtime, entry_list):

############################################################


# added by C.W. Murphy for glideFactoryEntryDescript
def write_descript(entry_name, entryDescript, entryAttributes, entryParams, monitor_dir):
entry_data = {entry_name: {}}
Expand Down
1 change: 0 additions & 1 deletion factory/glideFactoryEntryGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ def iterate(parent_pid, sleep_time, advertize_rate, glideinDescript, frontendDes
factory_downtimes = glideFactoryDowntimeLib.DowntimeFile(glideinDescript.data["DowntimesFile"])

while True:

# Check if parent is still active. If not cleanup and die.
check_parent(parent_pid, glideinDescript, my_entries)

Expand Down
15 changes: 8 additions & 7 deletions factory/glideFactoryInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def findGroupWork(
kel = data[k]
el = {"requests": {}, "web": {}, "params": {}, "params_decrypted": {}, "monitor": {}, "internals": {}}

for (key, prefix) in (
for key, prefix in (
("requests", factoryConfig.client_req_prefix),
("web", factoryConfig.client_web_prefix),
("params", factoryConfig.glidein_param_prefix),
Expand Down Expand Up @@ -308,7 +308,7 @@ def findGroupWork(

invalid_classad = False

for (key, prefix) in (("params_decrypted", factoryConfig.encrypted_param_prefix),):
for key, prefix in (("params_decrypted", factoryConfig.encrypted_param_prefix),):
# TODO: useless for, only one element
plen = len(prefix)
for attr in kel:
Expand Down Expand Up @@ -476,7 +476,7 @@ def findWork(
for k in list(data.keys()):
kel = data[k]
el = {"requests": {}, "web": {}, "params": {}, "params_decrypted": {}, "monitor": {}, "internals": {}}
for (key, prefix) in (
for key, prefix in (
("requests", factoryConfig.client_req_prefix),
("web", factoryConfig.client_web_prefix),
("params", factoryConfig.glidein_param_prefix),
Expand Down Expand Up @@ -516,7 +516,7 @@ def findWork(
continue # uh oh... either the client is misconfigured, or someone is trying to cheat

invalid_classad = False
for (key, prefix) in (("params_decrypted", factoryConfig.encrypted_param_prefix),):
for key, prefix in (("params_decrypted", factoryConfig.encrypted_param_prefix),):
plen = len(prefix)
for attr in list(kel.keys()):
if attr in reserved_names:
Expand Down Expand Up @@ -632,7 +632,7 @@ def __init__(
self.adParams["GlideinRequireGlideinProxy"] = "%s" % True

# write out both the attributes, params and monitors
for (prefix, data) in (
for prefix, data in (
(factoryConfig.glidein_attr_prefix, glidein_attrs),
(factoryConfig.glidein_param_prefix, glidein_params),
(factoryConfig.glidein_monitor_prefix, glidein_monitors),
Expand Down Expand Up @@ -705,7 +705,6 @@ def __init__(self, factory_name, glidein_name, supported_signtypes, pub_key_obj)
def advertizeGlobal(
factory_name, glidein_name, supported_signtypes, pub_key_obj, stats_dict={}, factory_collector=DEFAULT_VAL
):

"""
Creates the glidefactoryglobal classad and advertises.
Expand Down Expand Up @@ -793,6 +792,7 @@ def deadvertizeFactory(factory_name, glidein_name, factory_collector=DEFAULT_VAL

############################################################


# glidein_attrs is a dictionary of values to publish
# like {"Arch":"INTEL","MinDisk":200000}
# similar for glidein_params and glidein_monitor_monitors
Expand Down Expand Up @@ -952,6 +952,7 @@ def writeToMultiClassadFile(self, filename=None, append=True):
##############################
# Start INTERNAL


# glidein_attrs is a dictionary of values to publish
# like {"Arch":"INTEL","MinDisk":200000}
# similar for glidein_params and glidein_monitor_monitors
Expand Down Expand Up @@ -1011,7 +1012,7 @@ def createGlideinClientMonitoringFile(
fd.write("UpdateSequenceNumber = %i\n" % advertizeGFCCounter[client_name])

# write out both the attributes, params and monitors
for (prefix, data) in (
for prefix, data in (
(factoryConfig.glidein_attr_prefix, glidein_attrs),
(factoryConfig.glidein_param_prefix, client_params),
(factoryConfig.glidein_monitor_prefix, client_monitors),
Expand Down
10 changes: 1 addition & 9 deletions factory/glideFactoryLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def secClass2Name(client_security_name, proxy_security_class):


def getCondorQData(entry_name, client_name, schedd_name, factoryConfig=None):

"""
Get Condor data, given the glidein name
To be passed to the main functions
Expand Down Expand Up @@ -405,7 +404,6 @@ def getCondorStatusData(
client_startd_attribute=None,
factoryConfig=None,
):

if factoryConfig is None:
factoryConfig = globals()["factoryConfig"]

Expand Down Expand Up @@ -580,7 +578,6 @@ def __init__(
client_group_sign,
factoryConfig=None,
):

if factoryConfig is None:
factoryConfig = globals()["factoryConfig"]

Expand Down Expand Up @@ -832,7 +829,6 @@ def clean_glidein_queue(
log=logSupport.log,
factoryConfig=None,
):

"""Cleans up the glideins queue (removes any excesses) per the frontend request.
We are not adjusting the glidein totals with what has been removed from the queue. It may take a cycle (or more)
Expand Down Expand Up @@ -1000,7 +996,6 @@ def clean_glidein_queue(


def sanitizeGlideins(condorq, log=logSupport.log, factoryConfig=None):

if factoryConfig is None:
factoryConfig = globals()["factoryConfig"]

Expand Down Expand Up @@ -1739,7 +1734,6 @@ def removeGlideins(schedd_name, jid_list, force=False, log=logSupport.log, facto

is_not_first = 0
for jid in jid_list:

# Respect the max_removes limit and exit right away if required
if len(removed_jids) >= factoryConfig.max_removes:
break # limit reached, stop
Expand Down Expand Up @@ -1823,7 +1817,6 @@ def get_submit_environment(
log=logSupport.log,
factoryConfig=None,
):

if factoryConfig is None:
factoryConfig = globals()["factoryConfig"]

Expand Down Expand Up @@ -2241,7 +2234,6 @@ class GlideinTotals:
"""Keeps track of all glidein totals."""

def __init__(self, entry_name, frontendDescript, jobDescript, entry_condorQ, log=logSupport.log):

# Initialize entry limits
self.entry_name = entry_name
self.entry_max_glideins = int(jobDescript.data["PerEntryMaxGlideins"])
Expand Down Expand Up @@ -2288,7 +2280,7 @@ def __init__(self, entry_name, frontendDescript, jobDescript, entry_condorQ, log
("PerFrontendMaxHeld", "max_held"),
)

for (jd_key, max_glideinstatus_key) in limits_keynames:
for jd_key, max_glideinstatus_key in limits_keynames:
fe_glideins_param = jobDescript.data[jd_key]

if fe_glideins_param.find(";") != -1:
Expand Down
1 change: 0 additions & 1 deletion factory/glideFactoryMonitorAggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ def aggregateRRDStats(log=logSupport.log):
tab = xmlFormat.DEFAULT_TAB

for rrd in rrdstats_relname:

# assigns the data from every site to 'stats'
stats = {}
for entry in monitorAggregatorConfig.entries:
Expand Down
6 changes: 4 additions & 2 deletions factory/glideFactoryMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def write_rrd_multi_hetero(self, relative_fname, ds_desc_dict, time, val_dict):
#
#######################################################################################################################


# TODO: ['Downtime'] is added to the self.data[client_name] dictionary only if logRequest is called before logSchedd, logClientMonitor
# This is inconsistent and should be changed, Redmine [#17244]
class condorQStats:
Expand Down Expand Up @@ -1234,7 +1235,6 @@ def get_xml_updated(self, indent_tab=xmlFormat.DEFAULT_TAB, leading_tab=""):
return xmlFormat.time2xml(self.updated, "updated", indent_tab, leading_tab)

def write_file(self, monitoringConfig=None):

if monitoringConfig is None:
monitoringConfig = globals()["monitoringConfig"]

Expand Down Expand Up @@ -1488,7 +1488,8 @@ def fetchData(self, rrd_file, pathway, res, start, end):
rrdtool fetch returns 3 tuples: a[0], a[1], & a[2].
[0] lists the resolution, start and end time, which can be specified as arugments of fetchData.
[1] returns the names of the datasets. These names are listed in the key.
[2] is a list of tuples. each tuple contains data from every dataset. There is a tuple for each time data was collected."""
[2] is a list of tuples. each tuple contains data from every dataset. There is a tuple for each time data was collected.
"""

# use rrdtool to fetch data
baseRRDSupport = rrdSupport.rrdSupport()
Expand Down Expand Up @@ -1806,6 +1807,7 @@ def writeFile(self, path, xml_str, singleEntry=False):

############### P R I V A T E ################


##################################################
def getAllJobTypes():
return ("validation", "idle", "badput", "nosuccess")
Expand Down
1 change: 0 additions & 1 deletion factory/manageFactoryDowntimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ def vacuum(entry_or_id, opt_dict):


def get_production_ress_entries(server, ref_dict_list):

production_entries = []

condor_obj = condorMonitor.CondorStatus(pool_name=server)
Expand Down
Loading

0 comments on commit 6642ac1

Please sign in to comment.