Skip to content

Commit 28ee150

Browse files
author
dabercro
committed
Remove iteritems and use old scikit-learn
1 parent 2597456 commit 28ee150

9 files changed

Lines changed: 30 additions & 30 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
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',

workflowwebtools/clusterworkflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def get_clustered_group(workflow, clusterer, session=None):
208208
group = predictions.get(workflow)
209209

210210
if group is not None:
211-
for wkf, cluster in predictions.iteritems():
211+
for wkf, cluster in predictions.items():
212212
if cluster == group and wkf != workflow:
213213
output.append(wkf)
214214

workflowwebtools/errorutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def open_location(data_location):
9090
return raw
9191

9292
return errors_from_list([
93-
workflow for workflow, statuses in raw.iteritems()
93+
workflow for workflow, statuses in raw.items()
9494
if True in ['manual' in status for status in statuses]
9595
])
9696

workflowwebtools/globalerrors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,20 @@ def group_errors(input_errors, grouping_function, **kwargs):
405405

406406
output = default_errors_format()
407407

408-
for subgroup, values in input_errors.iteritems():
408+
for subgroup, values in input_errors.items():
409409

410410
group = grouping_function(subgroup)
411411

412412
# We have three variables for everything, so we can write this by hand
413413
# Not ideal
414-
for row, row_val in values['errors'].iteritems():
415-
for col, numerrors in row_val.iteritems():
414+
for row, row_val in values['errors'].items():
415+
for col, numerrors in row_val.items():
416416
output[group]['errors'][row][col] += numerrors
417417

418418
output[group]['sub'][subgroup] = values
419419
output[group]['total'] += values['total']
420420

421-
for key, func in kwargs.iteritems():
421+
for key, func in kwargs.items():
422422
output[group][key] = func(group)
423423

424424
return output

workflowwebtools/manageactions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def extract_reasons_params(action, **kwargs):
3636
if not isinstance(tasks_to_do, list):
3737
tasks_to_do = [tasks_to_do]
3838

39-
for key, item in kwargs.iteritems():
39+
for key, item in kwargs.items():
4040

4141
if 'shortreason' in key:
4242
short_re = item or reasonsmanip.DEFAULT_SHORT
@@ -140,7 +140,7 @@ def submitaction(user, workflows, action, session=None, **kwargs):
140140
# Get any existing thing (most likely not there)
141141
step_params = wf_params.get(short_step_name, {})
142142

143-
for key, val in all_steps.iteritems():
143+
for key, val in all_steps.items():
144144
# This also includes if the key value is set but blank
145145
if not step_params.get(key):
146146
step_params[key] = val
@@ -315,7 +315,7 @@ def fix_sites(**kwargs):
315315

316316
coll = get_actions_collection()
317317

318-
for task, value in params.iteritems():
318+
for task, value in params.items():
319319
split_task = task.split('/')
320320
workflow = split_task[1]
321321
subtask = '/'.join(split_task[2:])

workflowwebtools/paramsregression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def convert_to_dense(errors, keys=None, allerrors=None, allsites=None):
4242
allsites = set()
4343

4444
for status in keys:
45-
for error, sites in errors[status].iteritems():
45+
for error, sites in errors[status].items():
4646
allerrors.add(int(error))
4747
for site in sites:
4848
allsites.add(site)
@@ -99,7 +99,7 @@ def get_classifier(raw_data, parameter, **kwargs):
9999
matrix = raw_data[key]['errors'][status]
100100
# Only do this for sparse matrices
101101
if not isinstance(matrix, list):
102-
for error, sites in matrix.iteritems():
102+
for error, sites in matrix.items():
103103
allerrors.add(int(error))
104104
for site in sites:
105105
allsites.add(site)

workflowwebtools/statuses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ def get_manual_workflows(location):
3434
"""
3535

3636
return [workflow for workflow, statuses
37-
in open_statuses(location).iteritems()
37+
in open_statuses(location).items()
3838
if True in ['manual' in status for status in statuses]]

workflowwebtools/workflowinfo.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ def errors_for_workflow(workflow, url='cmsweb.cern.ch'):
133133
if not result['result']:
134134
return output
135135

136-
for step, stepdata in result['result'][0].get(workflow, {}).iteritems():
136+
for step, stepdata in result['result'][0].get(workflow, {}).items():
137137
errors = {}
138-
for code, codedata in stepdata.get('jobfailed', {}).iteritems():
138+
for code, codedata in stepdata.get('jobfailed', {}).items():
139139
sites = {}
140-
for site, sitedata in codedata.iteritems():
140+
for site, sitedata in codedata.items():
141141
if sitedata['errorCount']:
142142
sites[site] = sitedata['errorCount']
143143

@@ -261,7 +261,7 @@ def get_workflow_parameters(self):
261261
use_https=True, use_cert=True)
262262

263263
for params in result['result']:
264-
for key, item in params.iteritems():
264+
for key, item in params.items():
265265
if key == self.workflow:
266266
return item
267267

@@ -351,13 +351,13 @@ def get_failure_rate(self):
351351

352352
nsuccess = 0
353353
nfailure = 0
354-
for agent, agentdata in wf_agents.iteritems():
354+
for agent, agentdata in wf_agents.items():
355355
status = agentdata.get('status', {})
356356
if not status: continue
357357

358358
nsuccess += status.get('success', 0)
359359

360-
for ftype, num in status.get('failure', {}).iteritems():
360+
for ftype, num in status.get('failure', {}).items():
361361
nfailure += num
362362

363363
try:
@@ -407,7 +407,7 @@ def get_recovery_info(self):
407407
task = doc['fileset_name']
408408
# For each task, we have the following keys:
409409
# sites - a set of sites that the recovery docs say to run on.
410-
for replica, info in doc['files'].iteritems():
410+
for replica, info in doc['files'].items():
411411
# For fake files, just return the site whitelist
412412
if replica.startswith('MCFakeFile'):
413413
locations = site_white_list
@@ -478,14 +478,14 @@ def get_explanation(self, errorcode, step=''):
478478
if self.explanations is None:
479479
self.explanations = defaultdict(lambda: defaultdict(lambda: []))
480480
result = self._get_jobdetail()
481-
for stepname, stepdata in result['result'][0].get(self.workflow, {}).iteritems():
481+
for stepname, stepdata in result['result'][0].get(self.workflow, {}).items():
482482
# Get the errors from both 'jobfailed' and 'submitfailed' details
483483
for error, site in [(error, site) for status in ['jobfailed', 'submitfailed'] \
484484
for error, site in stepdata.get(status, {}).items()]:
485485
if error == '0':
486486
continue
487487

488-
for sitename, samples in site.iteritems():
488+
for sitename, samples in site.items():
489489
for detail in [values for sample in samples['samples']
490490
for errs in sample['errors'].values()
491491
for values in errs]:
@@ -566,7 +566,7 @@ def get_workflows_requesttime(self):
566566
request = self.get_requests()
567567

568568
return [(workflow, time.mktime(datetime.datetime(*value['RequestDate']).timetuple())) \
569-
for workflow, value in request.iteritems()]
569+
for workflow, value in request.items()]
570570

571571
def get_workflows(self):
572572
"""

workflowwebtools/workflowtools.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ def getworkflows(self, prepid):
195195
"status": self.get_status(workflow),
196196
"errors": obj['obj'].sum_errors()
197197
}
198-
for workflow, obj in workflow_objs.iteritems()
198+
for workflow, obj in workflow_objs.items()
199199
]
200200

201201
self.lock.acquire()
202-
for workflow, obj in workflow_objs.iteritems():
202+
for workflow, obj in workflow_objs.items():
203203
if workflow not in self.workflows:
204204
self.workflows[workflow] = obj['obj']
205205
self.lock.release()
@@ -316,7 +316,7 @@ def getreasons(self):
316316
'long': longreason
317317
}
318318
for shortreason, longreason in
319-
sorted(reasonsmanip.reasons_list().iteritems())
319+
sorted(reasonsmanip.reasons_list().items())
320320
]
321321

322322

@@ -329,17 +329,17 @@ def workflowerrors(self, workflow):
329329
output = []
330330

331331
# Need to track total sites, so we need to do nested loops here
332-
for step, ecs in sorted(errors.iteritems()):
332+
for step, ecs in sorted(errors.items()):
333333
allsites = set()
334334

335335
codes = []
336336
for code, sites in sorted([
337337
(-1 if code == 'NotReported' else int(code), sites)
338-
for code, sites in ecs.iteritems()]):
338+
for code, sites in ecs.items()]):
339339

340340
sites = {
341341
site: (num or int(code < 0))
342-
for site, num in sorted(sites.iteritems())
342+
for site, num in sorted(sites.items())
343343
}
344344
allsites.update(sites.keys())
345345

@@ -667,7 +667,7 @@ def submitaction(self, workflows='', action='', **kwargs):
667667
for workflow in workflows:
668668
# Check sites of recovered workflows
669669
if check_actions[workflow]['Action'] in ['acdc', 'recovery']:
670-
for subtask, params in check_actions[workflow]['Parameters'].iteritems():
670+
for subtask, params in check_actions[workflow]['Parameters'].items():
671671
# Empty sites are noted
672672
if not params.get('sites'):
673673
blank_sites_subtask.append('/%s/%s' % (workflow, subtask))

0 commit comments

Comments
 (0)