Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

componentInfo can hang indefinitely #1211

Open
wants to merge 4 commits into
base: python3-migration-fast
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Unified/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def actor(url,options=None):
if mlock(): return
if userLock('actor'): return

up = componentInfo(soft=['mcm'])
up = componentInfo(ignore=['mcm'])
if not up.check(): return

# CI = campaignInfo()
Expand Down
2 changes: 1 addition & 1 deletion Unified/addHoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import random
from JIRAClient import JIRAClient

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])
if not up.check(): sys.exit(0)

JC = JIRAClient() if up.status.get('jira',False) else None
Expand Down
8 changes: 5 additions & 3 deletions Unified/checkor.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ def checkor(url, spec=None, options=None):
UC = unifiedConfiguration()

use_mcm = True
up = componentInfo(soft=['mcm', 'wtc'])
up = componentInfo(ignore=['mcm', 'wtc'])
if not up.check(): return

use_mcm = up.status['mcm']
up_mcm = componentInfo(ignore=['wtc'])
up_mcm.check()
use_mcm = up_mcm.status['mcm']

now_s = time.mktime(time.gmtime())

Expand Down Expand Up @@ -192,7 +194,7 @@ def time_point(label="", sub_lap=False, percent=None, is_end=False):
user = c.author.name
prepid = jira.fields.summary.split()[0]
keyword = \
c.body[(c.body.find(force_complete_jira_string) + len(force_complete_jira_string)):].split()[0]
c.body[(c.body.find(force_complete_jira_string) + len(force_complete_jira_string)):].split()[0]
if keyword and user in actors:
print(user, "is force-completing", keyword, "from JIRA")
bypasses.append(keyword)
Expand Down
6 changes: 3 additions & 3 deletions Unified/closor.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def closor(url, specific=None, options=None):
if userLock(): return
mlock = moduleLock()
if mlock() and not options.manual: return
up = componentInfo(soft=['mcm','wtc'])
up = componentInfo(ignore=['mcm','wtc'])
if not up.check(): return


Expand Down Expand Up @@ -511,7 +511,7 @@ def close(self):
wfi.sendLog('closor',"Delayed announcement of %s due to unresolved Parentage dependencies" % wfi.request['RequestName'])
results.append('No ParentageResolved')

if all([result in ['None',None,True] for result in results]):
if all([result in ['None',None,True,'No ParentageResolved'] for result in results]):
if not jump_the_line:
## only announce if all previous are fine
res = reqMgrClient.announceWorkflowCascade(url, wfo.name)
Expand All @@ -527,7 +527,7 @@ def close(self):
results.append( res )

print(results)
if all([result in ['None',None,True, 'No ParentageResolved'] for result in results]):
if all([result in ['None',None,True,'No ParentageResolved'] for result in results]):
if jump_the_line:
if not 'announced' in wfo.status:
self.to_status = wfo.status.replace('announce','announced')
Expand Down
6 changes: 4 additions & 2 deletions Unified/completor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ def completor(url, specific):


use_mcm = True
up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])
if not up.check(): return
use_mcm = up.status['mcm']
up_mcm = componentInfo(ignore=['wtc','jira'])
up_mcm.check()
use_mcm = up_mcm.status['mcm']
if use_mcm:
mcm = McMClient(dev=False)

Expand Down
2 changes: 1 addition & 1 deletion Unified/equalizor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def equalizor(url , specific = None, options=None):

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])

if not specific:
if not up.check(): return # Only check component when running cron job with everything
Expand Down
2 changes: 1 addition & 1 deletion Unified/htmlor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def htmlor( caller = ""):
mlock = moduleLock(silent=True)
if mlock(): return

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])
if not up.check(): return

#for backup in ['statuses.json','siteInfo.json','equalizor.json']:
Expand Down
7 changes: 5 additions & 2 deletions Unified/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ def injector(url, options, specific):
if mlock() and not options.manual: return

use_mcm = True
up = componentInfo(soft=['mcm','wtc','jira'] )
up = componentInfo(ignore=['mcm','wtc','jira'] )
if not up.check(): return
use_mcm = up.status['mcm']

up_mcm = componentInfo(ignore=['wtc','jira'] )
up_mcm.check()
use_mcm = up_mcm.status['mcm']

UC = unifiedConfiguration()

Expand Down
2 changes: 1 addition & 1 deletion Unified/invalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def invalidator(url, invalid_status='INVALID'):
use_mcm = True
up = componentInfo(soft=['wtc','jira'])
up = componentInfo(ignore=['wtc','jira'])
if not up.check(): return
mcm = McMClient(dev=False)

Expand Down
2 changes: 1 addition & 1 deletion Unified/mappor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def mappor(url , options=None):

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])

## define regionality site => fallback allowed. feed on an ssb metric ??
mapping = defaultdict(list)
Expand Down
4 changes: 2 additions & 2 deletions Unified/recoveror.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def singleRecovery(url, task , initial, actions, do=False):
def new_recoveror(url, specific, options=None):
if userLock('recoveror'): return

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])
if not up.check(): return

CI = campaignInfo()
Expand Down Expand Up @@ -256,7 +256,7 @@ def new_recoveror(url, specific, options=None):
def recoveror(url,specific,options=None):
if userLock('recoveror'): return

up = componentInfo(soft=['mcm','wtc','jira'])
up = componentInfo(ignore=['mcm','wtc','jira'])
if not up.check(): return

CI = campaignInfo()
Expand Down
2 changes: 1 addition & 1 deletion Unified/rejector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def rejector(url, specific, options=None):
if options.test:
print "Test mode - no changes propagate to the production system"

if not componentInfo(soft=['wtc','jira']).check() and not options.manual: return
if not componentInfo(ignore=['wtc','jira']).check() and not options.manual: return

if specific and specific.startswith('/'):
## this is for a dataset
Expand Down
20 changes: 12 additions & 8 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ def checkMemory():


class componentInfo:
def __init__(self, block=True, mcm=None, soft=None, keep_trying=False, check_timeout=120):
self.checks = componentCheck(block, mcm, soft, keep_trying)
def __init__(self, block=True, mcm=None, ignore=None, keep_trying=False, check_timeout=120):
self.checks = componentCheck(block, mcm, ignore, keep_trying)
self.check_timeout = check_timeout
# start the checking
self.checks.start()
Expand All @@ -483,6 +483,7 @@ def check(self):
now - check_start, self.check_timeout, self.checks.checking)
sendLog('componentInfo', alarm, level='critical')
return False

print("componentInfo, ping", now, check_start, now - check_start)
time.sleep(ping)

Expand All @@ -493,13 +494,13 @@ def check(self):


class componentCheck(threading.Thread):
def __init__(self, block=True, mcm=None, soft=None, keep_trying=False):
def __init__(self, block=True, mcm=None, ignore=None, keep_trying=False):
threading.Thread.__init__(self)
self.daemon = True
if soft is None:
self.soft = ['mcm', 'wtc', 'mongo', 'jira'] ##components that are not mandatory
if ignore is None:
self.ignore = ['mcm', 'wtc', 'mongo', 'jira'] ##components that are not necessary
else:
self.soft = soft
self.ignore = ignore
self.block = block
self.status = {
'reqmgr': False,
Expand Down Expand Up @@ -581,6 +582,9 @@ def check(self):
for component in sorted(self.status):
ecode += 1
self.checking = component
if component in self.ignore and self.ignore is not None:
print("Skipping", component)
continue
while True:
try:
print("checking on", component)
Expand All @@ -598,8 +602,8 @@ def check(self):
print(traceback.format_exc())
print(component, "is unreachable")
print(str(e))
if self.block and not (self.soft and component in self.soft):
self.code = ecode
if self.block:
self.ecode = ecode
return False
break

Expand Down