Skip to content

Commit 1816709

Browse files
authored
Merge pull request #6 from phylsix/py3
Py3 compatible
2 parents a21377a + 91bc349 commit 1816709

25 files changed

Lines changed: 105 additions & 237 deletions

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
language: python
2-
python: 2.7
3-
dist: trusty
2+
matrix:
3+
include:
4+
- dist: trusty
5+
python: 2.7
6+
- dist: xenial
7+
python: 3.7
8+
env:
9+
- nodoc=true
410
services:
511
- mongodb
612
env: TMPDIR=$PWD/tmp

docs/api.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ From the URL root index, users will be able to directly access the following:
1616
- :ref:`global-view-ref`
1717
- :ref:`new-user-ref`
1818
- :ref:`reset-pass-ref`
19-
- :ref:`show-logs-ref`
2019

2120
.. _global-view-ref:
2221

@@ -53,13 +52,6 @@ Reporting Completed Actions
5352

5453
.. automethod:: workflowtools.WorkflowTools.reportaction
5554

56-
.. _show-logs-ref:
57-
58-
Viewing Workflow Logs
59-
~~~~~~~~~~~~~~~~~~~~~
60-
61-
.. automethod:: workflowtools.WorkflowTools.showlog
62-
6355
.. _new-user-ref:
6456

6557
Creating a New Account

docs/python_modules.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ Manage Actions
5555
.. automodule:: WorkflowWebTools.manageactions
5656
:members:
5757

58-
Show Log
59-
~~~~~~~~
60-
61-
.. automodule:: WorkflowWebTools.showlog
62-
:members:
63-
6458
Classifying Errors
6559
~~~~~~~~~~~~~~~~~~
6660

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
'templates/*']
1919
},
2020
install_requires=[
21-
'cmstoolbox>=0.11.3',
21+
'cmstoolbox>=0.12.0',
2222
'more-itertools<6.0.0',
2323
'cherrypy<18.0.0',
2424
'mako',
2525
'numpy>=1.6.1',
2626
'scipy==1.1.0',
27-
'sklearn',
27+
'scikit-learn==0.20.3',
2828
'passlib>=1.6',
2929
'bcrypt',
3030
'pyOpenSSL',
@@ -35,6 +35,6 @@
3535
'cx_Oracle',
3636
'pandas',
3737
'keras',
38-
'tensorflow'
38+
'tensorflow<2.0'
3939
]
4040
)

test/test_report_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setUp(self):
2828
self.coll = manageactions.get_actions_collection()
2929
# Check that test database is empty
3030
if self.coll.count() != 0:
31-
print 'Test database not empty, abort!!'
31+
print('Test database not empty, abort!!')
3232
exit(123)
3333

3434
now = time.time()

test/test_workflowwebtools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ def setUp(self):
237237
if os.path.exists('reasons.db'):
238238
os.remove('reasons.db')
239239

240-
print 'before', rm.reasons_list()
240+
print('before', rm.reasons_list())
241241

242242
rm.update_reasons(self.reasons)
243243

244-
print 'after', rm.reasons_list()
244+
print('after', rm.reasons_list())
245245

246246

247247
def tearDown(self):
@@ -291,7 +291,7 @@ def setUp(self):
291291
rm.update_reasons(self.reasons1)
292292

293293
if ma.get_actions_collection().count() != 0:
294-
print 'Test database not empty, abort!!'
294+
print('Test database not empty, abort!!')
295295
exit(123)
296296

297297
file_name = WorkflowInfo(self.request_base['workflows']).cache_filename('workflow_params')

workflowmonit/dumpWfStatusDb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/user/bin/env python
2+
from __future__ import print_function
23
import os
34
import sys
45
import sqlite3

workflowmonit/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
schedule
22
git+https://github.com/dmwm/WMCore.git
33
stomp.py
4+
pyyaml>=5.1

workflowmonit/stompAMQ.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env python
2-
from __future__ import print_function
3-
42
import json
53

64
from WMCore.Services.StompAMQ.StompAMQ import StompAMQ

workflowmonit/workflowCollector.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_yamlconfig(configPath):
4444
return {}
4545

4646
try:
47-
return yaml.load(open(configPath).read())
47+
return yaml.load(open(configPath).read(), Loader=yaml.FullLoader)
4848
except:
4949
return {}
5050

@@ -290,7 +290,7 @@ def error_logs(workflow):
290290
if not wf_stepinfo:
291291
return error_logs
292292

293-
for stepname, stepdata in wf_stepinfo.iteritems():
293+
for stepname, stepdata in wf_stepinfo.items():
294294
_taskName = stepname.split('/')[-1]
295295
# Get the errors from both 'jobfailed' and 'submitfailed' details
296296
for error, sitedata in [
@@ -301,7 +301,7 @@ def error_logs(workflow):
301301
continue
302302
_errorcode = int(error)
303303

304-
for _sitename, siteinfo in sitedata.iteritems():
304+
for _sitename, siteinfo in sitedata.items():
305305
_errorsamples = list()
306306

307307
for sample in siteinfo['samples']:
@@ -383,18 +383,18 @@ def error_summary(workflow):
383383
if not errorInfo:
384384
return error_summary
385385

386-
for fullTaskName, taskErrors in errorInfo.iteritems():
386+
for fullTaskName, taskErrors in errorInfo.items():
387387
taskName = fullTaskName.split('/')[-1]
388388
if not taskName:
389389
continue
390390

391391
errorList = list()
392392
noReportSite = list(taskErrors.get('NotReported', {}).keys())
393-
for errorCode, siteCnt in taskErrors.iteritems():
393+
for errorCode, siteCnt in taskErrors.items():
394394
if errorCode == 'NotReported':
395395
continue
396396

397-
for siteName, counts in siteCnt.iteritems():
397+
for siteName, counts in siteCnt.items():
398398
errorList.append({
399399
'errorCode': int(errorCode),
400400
'siteName': siteName,
@@ -457,16 +457,16 @@ def populate_error_for_workflow(workflow):
457457
workflow_summary['transitions'] = requestTransition
458458

459459
nfailure = 0
460-
for agent, agentdata in agentJobInfo.iteritems():
460+
for agent, agentdata in agentJobInfo.items():
461461
status = agentdata.get('status', {})
462462
tasks = agentdata.get('tasks', {})
463463
if not all([status, tasks]):
464464
continue
465465

466-
for ftype, num in status.get('failure', {}).iteritems():
466+
for ftype, num in status.get('failure', {}).items():
467467
nfailure += num
468468

469-
for taskFullName, taskData in tasks.iteritems():
469+
for taskFullName, taskData in tasks.items():
470470
taskName = taskFullName.split('/')[-1]
471471

472472
inputTask = None
@@ -479,13 +479,13 @@ def populate_error_for_workflow(workflow):
479479
taskSiteError = dict()
480480

481481
if taskStatus and taskStatus.get('failure', {}):
482-
for site, siteData in taskData.get('sites', {}).iteritems():
482+
for site, siteData in taskData.get('sites', {}).items():
483483
errCnt = 0
484484
errCnts = siteData.get('failure', {})
485485
if not errCnts:
486486
continue
487487

488-
for ftype, cnt in errCnts.iteritems():
488+
for ftype, cnt in errCnts.items():
489489
errCnt += cnt
490490

491491
taskSiteError[site] = errCnt
@@ -499,7 +499,7 @@ def populate_error_for_workflow(workflow):
499499
if 'siteErrors' not in _task.keys():
500500
_task["siteErrors"] = taskSiteError
501501
else:
502-
for site, errors in taskSiteError.iteritems():
502+
for site, errors in taskSiteError.items():
503503
if site in _task["siteErrors"].keys():
504504
_task["siteErrors"][site] += errors
505505
else:
@@ -517,7 +517,7 @@ def populate_error_for_workflow(workflow):
517517

518518
# remove tasks that does not have any error
519519
taskToDel = list()
520-
for taskname, taskinfo in workflow_summary['tasks'].iteritems():
520+
for taskname, taskinfo in workflow_summary['tasks'].items():
521521
if 'siteErrors' in taskinfo and (not taskinfo['siteErrors']):
522522
taskToDel.append(taskname)
523523
for taskname in taskToDel:
@@ -531,17 +531,17 @@ def populate_error_for_workflow(workflow):
531531
wf_errorLog = error_logs(workflow)
532532

533533
# add information from errorSummary
534-
for taskName, taskErrors in wf_errorSummary.iteritems():
534+
for taskName, taskErrors in wf_errorSummary.items():
535535
if taskName in workflow_summary['tasks'].keys():
536536
workflow_summary['tasks'][taskName].update(taskErrors)
537537

538538
# add information from errorLog
539-
for taskName, taskErrorLogInfo in wf_errorLog.iteritems():
539+
for taskName, taskErrorLogInfo in wf_errorLog.items():
540540

541541
if taskName not in workflow_summary['tasks'].keys():
542542
continue
543-
for errorCode, siteInfo in taskErrorLogInfo.iteritems():
544-
for site, info in siteInfo.iteritems():
543+
for errorCode, siteInfo in taskErrorLogInfo.items():
544+
for site, info in siteInfo.items():
545545

546546
for e in workflow_summary['tasks'][taskName].get('errors', []):
547547
if e.get('siteName', None) != site:
@@ -562,13 +562,13 @@ def populate_error_for_workflow(workflow):
562562

563563
# last step, nest in task key(TaskName) as a key-value pair
564564
tasksAsList = []
565-
for taskname, taskinfo in workflow_summary['tasks'].iteritems():
565+
for taskname, taskinfo in workflow_summary['tasks'].items():
566566
taskinfo.update({"name": taskname})
567567
taskinfo['siteErrors'] = [
568568
{
569569
"site": site,
570570
"counts": counts
571-
} for site, counts in taskinfo['siteErrors'].iteritems()
571+
} for site, counts in taskinfo['siteErrors'].items()
572572
] # convert 'siteErrors' from a dict to a list of dict
573573
tasksAsList.append(taskinfo)
574574
workflow_summary['tasks'] = tasksAsList

0 commit comments

Comments
 (0)