Skip to content

Commit

Permalink
Merge pull request #173 from PanDAWMS/formatting
Browse files Browse the repository at this point in the history
Formatting with black and autopep8
  • Loading branch information
fbarreir authored Sep 27, 2023
2 parents cbbc190 + 164ab88 commit 34401bb
Show file tree
Hide file tree
Showing 124 changed files with 14,993 additions and 15,347 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Core package for JEDI

## PanDA documentation

https://panda-wms.readthedocs.io/en/latest/

## JEDI installation instructions

https://panda-wms.readthedocs.io/en/latest/installation/jedi.html

## Release notes

See ChangeLog.txt

## JEDI cluster details for ATLAS

https://github.com/PanDAWMS/panda-jedi/wiki/ATLAS-production-JEDI-servers-%5BSeptember-2023%5D

12 changes: 12 additions & 0 deletions package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ exclude = [
".github",
".idea",
]

[tool.black]
line-length=160

[tool.autopep8]
# https://pypi.org/project/autopep8/#pyproject-toml
max_line_length = 160
ignore = ["E501", "W6"]
in-place = true
recursive = true
aggressive = 3

1,496 changes: 747 additions & 749 deletions pandajedi/jedibrokerage/AtlasAnalJobBroker.py

Large diffs are not rendered by default.

634 changes: 316 additions & 318 deletions pandajedi/jedibrokerage/AtlasBrokerUtils.py

Large diffs are not rendered by default.

1,155 changes: 581 additions & 574 deletions pandajedi/jedibrokerage/AtlasProdJobBroker.py

Large diffs are not rendered by default.

515 changes: 234 additions & 281 deletions pandajedi/jedibrokerage/AtlasProdTaskBroker.py

Large diffs are not rendered by default.

186 changes: 89 additions & 97 deletions pandajedi/jedibrokerage/GenJobBroker.py

Large diffs are not rendered by default.

59 changes: 24 additions & 35 deletions pandajedi/jedibrokerage/JobBrokerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from pandajedi.jedicore import Interaction

# base class for job brokerage
class JobBrokerBase (object):

def __init__(self,ddmIF,taskBufferIF):
# base class for job brokerage
class JobBrokerBase(object):
def __init__(self, ddmIF, taskBufferIF):
self.ddmIF = ddmIF
self.taskBufferIF = taskBufferIF
self.liveCounter = None
Expand Down Expand Up @@ -33,25 +33,17 @@ def set_task_common(self, attr_name, attr_value):
def refresh(self):
self.siteMapper = self.taskBufferIF.getSiteMapper()



def setLiveCounter(self,liveCounter):
def setLiveCounter(self, liveCounter):
self.liveCounter = liveCounter



def getLiveCount(self,siteName):
def getLiveCount(self, siteName):
if self.liveCounter is None:
return 0
return self.liveCounter.get(siteName)



def setLockID(self,pid,tid):
self.baseLockID = '{0}-jbr'.format(pid)
self.lockID = '{0}-{1}'.format(self.baseLockID,tid)


def setLockID(self, pid, tid):
self.baseLockID = "{0}-jbr".format(pid)
self.lockID = "{0}-{1}".format(self.baseLockID, tid)

def getBaseLockID(self):
if self.useLock:
Expand All @@ -63,25 +55,27 @@ def releaseSiteLock(self, vo, prodSourceLabel, queue_id):
if self.useLock:
self.taskBufferIF.unlockProcessWithPID_JEDI(vo, prodSourceLabel, queue_id, self.lockID, False)


def lockSite(self, vo, prodSourceLabel, siteName, queue_id):
if not self.useLock:
self.useLock = True
# FIXME: lockSite method is unused elswhere; lockProcess_JEDI arguments have changed and incompatible with the following line
# self.taskBufferIF.lockProcess_JEDI(vo, prodSourceLabel, siteName, queue_id, self.lockID, True)


def checkSiteLock(self, vo, prodSourceLabel, siteName, queue_id, resource_name):
return self.taskBufferIF.checkProcessLock_JEDI( vo=vo, prodSourceLabel=prodSourceLabel,
cloud=siteName, workqueue_id=queue_id,
resource_name=resource_name,
component=None, pid=self.baseLockID, checkBase=True)

return self.taskBufferIF.checkProcessLock_JEDI(
vo=vo,
prodSourceLabel=prodSourceLabel,
cloud=siteName,
workqueue_id=queue_id,
resource_name=resource_name,
component=None,
pid=self.baseLockID,
checkBase=True,
)

def setTestMode(self):
self.testMode = True


# get list of unified sites
def get_unified_sites(self, scan_site_list):
unified_list = set()
Expand All @@ -91,7 +85,6 @@ def get_unified_sites(self, scan_site_list):
unified_list.add(unifiedName)
return tuple(unified_list)


# get list of pseudo sites
def get_pseudo_sites(self, unified_list, scan_site_list):
unified_list = set(unified_list)
Expand All @@ -102,8 +95,6 @@ def get_pseudo_sites(self, unified_list, scan_site_list):
pseudo_list.add(tmpSiteName)
return tuple(pseudo_list)



# add pseudo sites to skip
def add_pseudo_sites_to_skip(self, unified_dict, scan_site_list, skipped_dict):
for tmpSiteName in scan_site_list:
Expand All @@ -115,30 +106,28 @@ def add_pseudo_sites_to_skip(self, unified_dict, scan_site_list, skipped_dict):
# init summary list
def init_summary_list(self, header, comment, initial_list):
self.summaryList = []
self.summaryList.append('===== {} ====='.format(header))
self.summaryList.append("===== {} =====".format(header))
if comment:
self.summaryList.append(comment)
self.summaryList.append('the number of initial candidates: {}'.format(len(initial_list)))
self.summaryList.append("the number of initial candidates: {}".format(len(initial_list)))

# dump summary
def dump_summary(self, tmp_log, final_candidates=None):
if not self.summaryList:
return
tmp_log.info('')
tmp_log.info("")
for m in self.summaryList:
tmp_log.info(m)
if not final_candidates:
final_candidates = []
tmp_log.info('the number of final candidates: {}'.format(len(final_candidates)))
tmp_log.info('')
tmp_log.info("the number of final candidates: {}".format(len(final_candidates)))
tmp_log.info("")

# make summary
def add_summary_message(self, old_list, new_list, message):
if old_list and len(old_list) != len(new_list):
red = int(math.ceil(((len(old_list) - len(new_list)) * 100) / len(old_list)))
self.summaryList.append('{:>5} -> {:>3} candidates, {:>3}% cut : {}'.format(len(old_list),
len(new_list),
red, message))
self.summaryList.append("{:>5} -> {:>3} candidates, {:>3}% cut : {}".format(len(old_list), len(new_list), red, message))


Interaction.installSC(JobBrokerBase)
7 changes: 3 additions & 4 deletions pandajedi/jedibrokerage/TaskBrokerBase.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pandajedi.jedicore import Interaction

# base class for task brokerge
class TaskBrokerBase (object):

def __init__(self,taskBufferIF,ddmIF):
# base class for task brokerge
class TaskBrokerBase(object):
def __init__(self, taskBufferIF, ddmIF):
self.ddmIF = ddmIF
self.taskBufferIF = taskBufferIF
self.refresh()
Expand All @@ -12,5 +12,4 @@ def refresh(self):
self.siteMapper = self.taskBufferIF.getSiteMapper()



Interaction.installSC(TaskBrokerBase)
12 changes: 7 additions & 5 deletions pandajedi/jediconfig/jedi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
tmpConf = LiveConfigParser()

# read
tmpConf.read('panda_jedi.cfg')
tmpConf.read("panda_jedi.cfg")


# dummy section class
class _SectionClass:
pass


# load configmap
config_map_data = {}
if 'PANDA_HOME' in os.environ:
config_map_name = 'panda_jedi_config.json'
config_map_path = os.path.join(os.environ['PANDA_HOME'], 'etc/config_json', config_map_name)
if "PANDA_HOME" in os.environ:
config_map_name = "panda_jedi_config.json"
config_map_path = os.path.join(os.environ["PANDA_HOME"], "etc/config_json", config_map_name)
if os.path.exists(config_map_path):
with open(config_map_path) as f:
config_map_data = json.load(f)
Expand All @@ -36,6 +38,6 @@ class _SectionClass:
# make section class
tmpSelf = _SectionClass()
# update module dict
sys.modules[ __name__ ].__dict__[tmpSection] = tmpSelf
sys.modules[__name__].__dict__[tmpSection] = tmpSelf
# expand all values
expand_values(tmpSelf, tmpDict)
Loading

0 comments on commit 34401bb

Please sign in to comment.