- From: Rion Dooley <dooley@tacc.utexas.edu>
- Date: Tue, 3 Apr 2012 16:16:26 +0000
- To: Jon Bringhurst <jonb@lanl.gov>
- CC: "public-hpcweb@w3.org" <public-hpcweb@w3.org>
I like the way you've thought through these. Out of curiosity, when you model "machines" as the reciepent of batch, queue, and fork jobs in your code, why are the routes not reflective of the same behavior? It seems a little more intuitive, given the api docs overall feel, to model the job submission as posts to: newt/machine/:machine/queue/fork newt/machine/:machine/queue/batch newt/machine/:machine/queue/<name> Then you could provide user jobs cleanly as: newt/jobs newt/jobs/machine/:machine newt/jobs/machine/:machine/queue/:queue newt/job/<jobid> And at the same time overload the paths to provide a more resource-centric view of user jobs as newt/machine/:machine/queue/:queue/jobs newt/machine/:machine/jobs Perhaps I'm just partial to using tokens in the url to drill down for specific information about the base resource, but to me, it just feels a little odd having a machine name hang off a queue token. Practically speaking, a machine is tangible encompassing object. A queue is part of a machine and, in many cases, there can be a 1:N relationship between machine and queue. Actually, at several sites, there is a 1:N:N relationship between machine and scheduler and queue which would make the existing organization a little tough to apply. That being said, I really do like the way you've thought through the organization of endpoints and resources. I'd love to kick around some ideas on this thread or offline and see if we can hash out a minimal subset of endpoints that we can adopt as "par" for an HPC web api. Cheers, Rion On 4/3/12 10:40 AM, "Jon Bringhurst" <jonb@lanl.gov> wrote: >Just in case this might be helpful to someone, here's the entire newt >API implemented in non-resource style rails 3 routes (with a slight >modification for authentication). I probably made a few mistakes, but it >should be very close to the original API: > > devise_scope :user do > # Newt authentication login > match 'newt/login' => 'devise/sessions#create', :via => :post > > # Newt authentication status > match 'newt/login' => 'devise/sessions#new', :via => :get > > # Newt authentication logout > match 'newt/logout' => 'devise/sessions#destroy', :via => :get > end > > # Newt status for all systems > match 'newt/status' => 'machines#status_all', :via => :get > > # Newt MOTD > match 'newt/status/motd' => 'machines#motd', :via => :get > > # Newt system status > match 'newt/status/:machine' => 'machines#status', :via => :get > > # Newt files directory listing (download file if params[:view] is >"read") > match 'newt/file/:machine/:path' => 'machines#file_info', :via => :get > > # Newt file upload > match 'newt/file/:machine/:path' => 'machines#upload_file', :via => >:post > > # Newt submit a fork job > match 'newt/job/:machine/fork' => 'machines#submit_fork', :via => :post > > # Newt submit a batch job > match 'newt/job/:machine/batch' => 'machines#submit_batch', :via => >:post > > # Newt query a job > match 'newt/job/jobs/:job_id' => 'machines#query_job', :via => :get > > # Newt query all jobs > match 'newt/job/jobs' => 'machines#all_jobs', :via => :get > > # Newt run a command > match 'newt/command/:machine' => 'machines#run_command', :via => :post > > # Newt view queue > match 'newt/queue/:machine' => 'machines#queue_job_all', :via => :get > > # Newt submit job to queue > match 'newt/queue/:machine' => 'machines#queue_job_submit', :via => >:post > > # Newt view job in queue > match 'newt/queue/:machine/:job_id' => 'machines#queue_job_query', >:via => :get > > # Newt delete job from queue > match 'newt/queue/:machine/:job_id' => 'machines#queue_job_delete', >:via => :delete > > # Newt liststore get available stores > match 'newt/stores' => 'liststores#all', :via => :get > > # Newt liststore create store > match 'newt/stores' => 'liststores#create', :via => :post > > # Newt liststore update store > match 'newt/stores/:store_name' => 'liststores#update_store', :via => >:put > > # Newt liststore get store contents > match 'newt/stores/:store_name' => 'liststores#get', :via => :get > > # Newt liststore update document > match 'newt/stores/:store_name/:document_name' => >'liststores#update_document', :via => :put > > # Newt liststore get document contents > match 'newt/stores/:store_name/:document_name' => >'liststores#get_document', :via => :get > > # Newt account get general user account information > match 'newt/account/:resource' => 'users#get_account_resource', :via >=> :get > >-Jon >
Received on Thursday, 5 April 2012 12:19:35 UTC