Skip to content

Commit

Permalink
Revert part of #4865 (#4871)
Browse files Browse the repository at this point in the history
* Remove deprecated jobids option from kill command help

* Complete clean-up

* Clean user cache if task was not sent to schedd

* Back to scheduler task status in purge command
  • Loading branch information
lecriste authored and belforte committed Jan 16, 2020
1 parent 1c6658c commit e1cdd9b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/python/CRABClient/Commands/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ def __call__(self):

tm_user_sandbox = getColumn(dictresult, 'tm_user_sandbox')
hashkey = tm_user_sandbox.replace(".tar.gz","")

self.logger.info('Checking task status')
status = getColumn(dictresult, 'tm_task_status')
self.logger.info('Task status: %s' % status)
accepstate = ['SUBMITFAILED','KILLED','FINISHED','FAILED','KILLFAILED', 'COMPLETED']
if status not in accepstate:
msg = ('%sError%s: Only tasks with these status can be purged: {0}'.format(accepstate) % (colors.RED, colors.NORMAL))
raise ConfigurationException(msg)

# Get the schedd address from the DB info and strip off the 'crab3@' prefix if it exists
scheddaddress = getColumn(dictresult, 'tm_schedd')
if scheddaddress:
Expand All @@ -47,6 +38,15 @@ def __call__(self):
else:
noSchedd = True

self.logger.info('Checking task status')
dictresult, _, _ = server.get(self.uri, data = {'workflow': self.cachedinfo['RequestName'], 'verbose': 0})
status = dictresult['result'][0]['status']
self.logger.info('Task status: %s' % status)
accepstate = ['SUBMITFAILED','KILLED','FINISHED','FAILED','KILLFAILED', 'COMPLETED']
if status not in accepstate:
msg = ('%sError%s: Only tasks with these status can be purged: {0}'.format(accepstate) % (colors.RED, colors.NORMAL))
raise ConfigurationException(msg)

# Getting the cache url
cacheresult = {}
scheddresult = {}
Expand Down

0 comments on commit e1cdd9b

Please sign in to comment.