request_splitter: rework stagings_load() to be public facing.
Notify user and exit early if not stagings worth considering.
This commit is contained in:
parent
3d3f0469a4
commit
4d08331250
@ -339,6 +339,12 @@ def do_staging(self, subcmd, opts, *args):
|
||||
return
|
||||
|
||||
splitter = RequestSplitter(api, open_requests, in_ring=True)
|
||||
|
||||
considerable = splitter.stagings_load(stagings)
|
||||
if considerable == 0:
|
||||
print('No considerable stagings on which to act')
|
||||
return
|
||||
|
||||
if len(requests) > 0:
|
||||
splitter.filter_add_requests(requests)
|
||||
if len(splitter.filters) == 0:
|
||||
@ -352,7 +358,7 @@ def do_staging(self, subcmd, opts, *args):
|
||||
splitter.group_by(group_by)
|
||||
splitter.split()
|
||||
|
||||
result = splitter.propose_assignment(stagings)
|
||||
result = splitter.propose_assignment()
|
||||
if result is not True:
|
||||
print('Failed to generate proposal: {}'.format(result))
|
||||
return
|
||||
|
@ -125,7 +125,7 @@ class RequestSplitter(object):
|
||||
return '00'
|
||||
return '__'.join(key)
|
||||
|
||||
def propose_stagings_load(self, stagings):
|
||||
def stagings_load(self, stagings):
|
||||
self.stagings_considerable = {}
|
||||
|
||||
if self.api.rings:
|
||||
@ -156,10 +156,9 @@ class RequestSplitter(object):
|
||||
# Allow both considered and remaining to be accessible after proposal.
|
||||
self.stagings_available = self.stagings_considerable.copy()
|
||||
|
||||
def propose_assignment(self, stagings):
|
||||
# Determine available stagings and make working copy.
|
||||
self.propose_stagings_load(stagings)
|
||||
return len(self.stagings_considerable)
|
||||
|
||||
def propose_assignment(self):
|
||||
if len(self.grouped) > len(self.stagings_available):
|
||||
return 'more groups than available stagings'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user