Merge lp:~stylesen/lava-scheduler/multinode into lp:lava-scheduler/multinode
Proposed by
Senthil Kumaran S
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Stevan Radaković | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 264 | ||||
Proposed branch: | lp:~stylesen/lava-scheduler/multinode | ||||
Merge into: | lp:lava-scheduler/multinode | ||||
Diff against target: |
104 lines (+41/-14) 2 files modified
lava_scheduler_app/api.py (+3/-14) lava_scheduler_app/models.py (+38/-0) |
||||
To merge this branch: | bzr merge lp:~stylesen/lava-scheduler/multinode | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stevan Radaković | Approve | ||
Linaro Automation & Validation | Pending | ||
Review via email: mp+175729@code.launchpad.net |
Description of the change
Check device availability during job submission, irrespective of what mode in which the job gets submitted.
To post a comment you must log in.
Hey Senthil, looking good.
Couple of propositions:
29 + except Exception as e: Fault(400, str(e))
30 + raise xmlrpclib.
I'd really like it better if we had a specialized exception for this one, using generic exception for special kind of problem is not really a good idea (something else goes wrong, or some uncaught exception is thrown, someone may thing there was not enough devices and this wasn't the case). So introducing something like DevicesUnavaila bleException would be good.
42 +def check_device_ availability( json_data) : _device_ count(json_ data)
43 + """Checks whether the number of devices requested in job json is
44 + available.
45 +
46 + Returns True if the requested number of devices are available, else
47 + raises an Exception.
48 + """
49 + requested_devices = utils.requested
Increasing re-usability of methods is always a good idea, so it would be better that this one actually takes the requested_devices as an argument, and actually parse the json_data from the api call (someone who needs this method coming from not api side will not be able to pass json_data etc..)