forked from PanDAWMS/panda-harvester
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Comm_layer
- Loading branch information
Showing
33 changed files
with
296 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-minimal |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import copy | ||
|
||
from pandaharvester.harvestercore import core_utils | ||
from pandaharvester.harvestercore.db_proxy import DBProxy | ||
from pandaharvester.harvestercore.plugin_factory import PluginFactory | ||
|
||
# logger | ||
_logger = core_utils.setup_logger() | ||
|
||
|
||
# class to define number of workers to submit | ||
class WorkerAssigner: | ||
# constructor | ||
def __init__(self, queue_config_mapper): | ||
self.queueConfigMapper = queue_config_mapper | ||
self.pluginFactory = PluginFactory() | ||
self.dbProxy = DBProxy() | ||
|
||
# define number of workers to submit based on various information | ||
def define_num_workers(self, static_num_workers, site_name): | ||
tmpLog = core_utils.make_logger(_logger, 'site={0}'.format(site_name)) | ||
tmpLog.debug('start') | ||
dyn_num_workers = copy.copy(static_num_workers) | ||
try: | ||
# get queue status | ||
queueStat = self.dbProxy.get_cache("panda_queues.json", None) | ||
if queueStat is None: | ||
queueStat = dict() | ||
else: | ||
queueStat = queueStat.data | ||
# define num of new workers | ||
for queueName, tmpVal in static_num_workers.iteritems(): | ||
# set 0 to num of new workers when the queue is disabled | ||
if queueName in queueStat and queueStat[queueName]['status'] in ['offline']: | ||
dyn_num_workers[queueName]['nNewWorker'] = 0 | ||
continue | ||
# get queue | ||
queueConfig = self.queueConfigMapper.get_queue(queueName) | ||
nQueue = tmpVal['nQueue'] | ||
nReady = tmpVal['nReady'] | ||
nRunning = tmpVal['nRunning'] | ||
nQueueLimit = queueConfig.nQueueLimitWorker | ||
maxWorkers = queueConfig.maxWorkers | ||
qrWorkerRatio = queueConfig.qrWorkerRatio | ||
# define num of new workers based on static site config | ||
nNewWorkers = 0 | ||
if nQueueLimit > 0 and nQueue >= nQueueLimit: | ||
# enough queued workers | ||
pass | ||
elif maxWorkers > 0 and (nQueue + nReady + nRunning) >= maxWorkers: | ||
# enough workers in the system | ||
pass | ||
elif qrWorkerRatio > 0 and nRunning > 0 and nQueue > qrWorkerRatio * nRunning / 100: | ||
# enough workers in terms of Running-to-Queued ratio | ||
pass | ||
else: | ||
# get max number of queued workers | ||
maxQueuedWorkers = 0 | ||
if nQueueLimit > 0: | ||
maxQueuedWorkers = nQueueLimit | ||
if qrWorkerRatio > 0 and nRunning > 0: | ||
maxQueuedWorkers = max(maxQueuedWorkers, qrWorkerRatio * nRunning / 100) | ||
if maxQueuedWorkers == 0: | ||
# use default value | ||
maxQueuedWorkers = 1 | ||
# new workers | ||
nNewWorkers = min(max(maxQueuedWorkers - nQueue, 0), | ||
max(maxWorkers - nQueue - nReady - nRunning, 0)) | ||
dyn_num_workers[queueName]['nNewWorker'] = nNewWorkers | ||
# correction for global shares | ||
# TO BE IMPLEMENTED | ||
# correction based on commands from PanDA | ||
# TO BE IMPLEMENTED | ||
# correction based on resource information | ||
# TO BE IMPLEMENTED : need plugin? | ||
# dump | ||
tmpLog.debug('defined {0}'.format(str(dyn_num_workers))) | ||
return dyn_num_workers | ||
except: | ||
# dump error | ||
core_utils.dump_error_message(tmpLog) | ||
return dyn_num_workers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.