(DIO-908) Floaty can now report the status of ABS requests

- If ABS queries returns a body for 200 or 202, floaty will print it
this is useful in the new version of ABS, since it shows the progress
for ondemand requests (AWS or vmpooler)
- removed the queue_place and querying the queue for a 'get' request
this queue_place number was misleading since it was just a redis index
and did not represent well where the request was in the queue
- Also added a flag option --continue to be used when the cli was
interrupted for example with ctrl-c
This commit is contained in:
Samuel Beaulieu 2021-02-09 11:29:08 -06:00
parent 85a63e85fe
commit a3d8484124
6 changed files with 30 additions and 31 deletions

View file

@ -39,6 +39,7 @@ class Vmfloaty
c.option '--force', 'Forces vmfloaty to get requested vms'
c.option '--json', 'Prints retrieved vms in JSON format'
c.option '--ondemand', 'Requested vms are provisioned upon receival of the request, tracked by a request ID'
c.option '--continue STRING', String, 'resume polling ABS for job_id, for use when the cli was interrupted'
c.action do |args, options|
verbose = options.verbose || config['verbose']
service = Service.new(options, config)
@ -52,6 +53,11 @@ class Vmfloaty
os_types = Utils.generate_os_hash(args)
if os_types.empty?
FloatyLogger.error 'No operating systems provided to obtain. See `floaty get --help` for more information on how to get VMs.'
exit 1
end
max_pool_request = 5
large_pool_requests = os_types.select { |_, v| v > max_pool_request }
if !large_pool_requests.empty? && !force
@ -60,12 +66,7 @@ class Vmfloaty
exit 1
end
if os_types.empty?
FloatyLogger.error 'No operating systems provided to obtain. See `floaty get --help` for more information on how to get VMs.'
exit 1
end
response = service.retrieve(verbose, os_types, use_token, options.ondemand)
response = service.retrieve(verbose, os_types, use_token, options.ondemand, options.continue)
request_id = response['request_id'] if options.ondemand
response = service.wait_for_request(verbose, request_id) if options.ondemand