Skip to content

Commit 7b87072

Browse files
author
Laurent Pouilloux
committed
increase version to 1.2.1 with pep8 fixes
1 parent cd726c8 commit 7b87072

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

funk

+24-27
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ description = 'This tool helps you to find resources on ' + \
3131
style.host('max') + ' = find the time slot where the maximum number of nodes are available.\n\n' + \
3232
"""If no arguments is given, compile the planning of the whole platform and generate an
3333
oargridsub command line with all available resources for 1 hour.
34-
Based on execo 2.2, """ + style.emph('http://execo.gforge.inria.fr/doc/') + \
34+
Based on execo 2.4, """ + style.emph('http://execo.gforge.inria.fr/doc/') + \
3535
'oar 2.5, ' + style.emph('http://oar.imag.fr') + '.'
3636

3737
epilog = style.host('Examples:') + \
@@ -60,7 +60,7 @@ optinout.add_argument("-h", "--help",
6060
help="show this help message and exit")
6161
optinout.add_argument('--version',
6262
action='version',
63-
version='%(prog)s 1.2')
63+
version='%(prog)s 1.2.1')
6464
optinout.add_argument("-m", "--mode",
6565
dest="mode",
6666
default='date',
@@ -100,7 +100,8 @@ optreservation = parser.add_argument_group(style.host("Reservation"),
100100
optreservation.add_argument("-r", "--resources",
101101
dest="resources",
102102
default="grid5000",
103-
help="Comma separated list of Grid'5000 elements (grid5000, site or cluster)" +
103+
help="Comma separated list of Grid'5000 elements " +
104+
" (grid5000, site or cluster)" +
104105
"\n-r element1,element2 for date and max modes" +
105106
"\n-r element1:n_nodes1,element2:n_nodes2 for free mode" +
106107
"\ndefault = %(default)s")
@@ -123,7 +124,7 @@ optreservation.add_argument("-k", "--kavlan",
123124
help="Ask for a KaVLAN")
124125
optreservation.add_argument("-n", "--subnet",
125126
dest="subnet",
126-
help="Ask for subnets. slash_22=1 will retrieve a /22 subnet on every site of your requests, "+\
127+
help="Ask for subnets. slash_22=1 will retrieve a /22 subnet on every site of your requests, " +\
127128
"\nbut you can specify site1:slash_22=2,site2:slash_19=1")
128129

129130
optreservation.add_argument("-j", "--job_name",
@@ -238,10 +239,10 @@ if args.virtual or args.green or args.infiniband:
238239
if args.virtual and not cluster_attr['supported_job_types']['virtual']:
239240
feature_blacklist.append(cluster)
240241
if args.infiniband and len(filter(lambda x: x['interface'] == 'InfiniBand',
241-
cluster_attr['network_adapters'])) == 0:
242+
cluster_attr['network_adapters'])) == 0:
242243
feature_blacklist.append(cluster)
243-
if args.green and (not 'sensors' in cluster_attr or \
244-
not cluster_attr['sensors']['power']):
244+
if args.green and ('sensors' not in cluster_attr or
245+
not cluster_attr['sensors']['power']):
245246
feature_blacklist.append(cluster)
246247
blacklisted = list(set(blacklisted + feature_blacklist))
247248

@@ -257,7 +258,8 @@ else:
257258
sites.append(element)
258259

259260

260-
# Adding network elements, and blacklisting rennes and nantes if kavlan is used and multiple sites wanted
261+
# Adding network elements, and blacklisting rennes and nantes if kavlan is used
262+
# and multiple sites wanted
261263
if args.kavlan:
262264
resources_wanted['kavlan'] = 1
263265
if len(sites) > 1:
@@ -268,16 +270,9 @@ if args.kavlan:
268270

269271
if args.subnet:
270272
resources_wanted['subnets'] = args.subnet
271-
logger.warning('subnet is not implemented in execo_g5k.planning, ' + \
272-
'we cannot assure that the requested resources will be available')
273-
#if args.storage:
274-
# resources_wanted['storage'] = args.storage
275-
# logger.warning('storage is not implemented in execo_g5k.planning, '+\
276-
# 'we cannot assure that the requested resources will be availables')
277-
# storage = True
278-
#else:
279-
# storage = False
280-
273+
logger.warning('subnet is not implemented in execo_g5k.planning, ' +
274+
'we cannot assure that the requested subnets will ' +
275+
'be available')
281276

282277
logger.info('From %s to %s', style.emph(format_date(args.startdate)),
283278
style.emph(format_date(args.enddate)))
@@ -290,12 +285,12 @@ show_resources({resource: n_nodes for resource, n_nodes in resources_wanted.iter
290285
# Computing the planning of the ressources wanted
291286
logger.info('Compiling planning')
292287
planning = get_planning(elements=resources_wanted.keys(),
293-
vlan=args.kavlan,
294-
subnet=False,
295-
storage=False,
296-
out_of_chart=args.charter,
297-
starttime=args.startdate,
298-
endtime=args.enddate)
288+
vlan=args.kavlan,
289+
subnet=False,
290+
storage=False,
291+
out_of_chart=args.charter,
292+
starttime=args.startdate,
293+
endtime=args.enddate)
299294

300295
# Determing the slots for the given walltime, i.e. finding the slice of time with constant resources
301296
logger.info('Calculating slots of %s ', args.walltime)
@@ -308,11 +303,13 @@ if args.plots:
308303
draw_gantt(planning, outfile="funk_gantt.png")
309304

310305
if MPL.__version__ < '1.2.0':
311-
logger.warning('Slots drawing use stackplot that requires matlplotlib >= 1.2.0')
306+
logger.warning('Slots drawing use stackplot that ' +
307+
'requires matlplotlib >= 1.2.0')
312308
else:
313309
draw_slots(slots, outfile="funk_slots.png")
314310
except:
315-
logger.warning('No matplotlib package detected, plots cannot be created')
311+
logger.warning('No matplotlib package detected, ' +
312+
'plots cannot be created')
316313
pass
317314

318315
# Determine the slot to use
@@ -340,7 +337,7 @@ resources = distribute_hosts(resources, resources_wanted, blacklisted,
340337
args.ratio)
341338
show_resources(resources, 'Resources selected')
342339

343-
logger.info(style.log_header('Chosen slot ') + format_date(startdate) + \
340+
logger.info(style.log_header('Chosen slot ') + format_date(startdate) +
344341
' -> ' + format_date(enddate))
345342

346343
jobs_specs = get_jobs_specs(resources, excluded_elements=blacklisted,

0 commit comments

Comments
 (0)