jupyter / tmpnb-redirector

Simple HTTP redirector for tmpnb nodes
BSD 3-Clause "New" or "Revised" License
12 stars 16 forks source link

Allow spawning from redirector (passing on from underlying nodes) #4

Closed rgbkrk closed 8 years ago

rgbkrk commented 9 years ago

When a user hits the /api/spawn endpoint:

POST /api/spawn

tmpnb redirector would then pass the POST on to one of the tmpnb nodes that has availability, returning their response but with a full path:

{'url': 'https://adsfaf.tmpnb.org/user/dsfasdf/'}

/cc @captainsafia

captainsafia commented 9 years ago

OK, so if I am understanding this right (first time diving into tmpnb-redirector codebase), we would like to:

  1. Add a /api/spawn route to the tmpnb-redirector app.
  2. Select a node within self.settings.stats that contains the most available containers.
  3. Redirect to that host with the payload originally provided in 1.

Does that seem correct? Also, how do we want to select the "node with availability" in step 2?

rgbkrk commented 9 years ago

Add a /api/spawn route to the tmpnb-redirector app.

Yup!

Select a node within self.settings.stats that contains the most available containers.

Yup!

Redirect to that host with the payload originally provided in 1.

Eh... There won't be a payload, the message body will be empty, just like the tmpnb /api/spawn endpoint.

how do we want to select the "node with availability" in step 2?

This currently gets done in the Reroute Handler, randomly selected from the available. You can use that for now, likely adapted into a separate function.

captainsafia commented 9 years ago

Eh... There won't be a payload, the message body will be empty, just like the tmpnb /api/spawn endpoint.

Totally knew that! Was checking to see if you did! ;) But yes, I got it.

This currently gets done in the Reroute Handler, randomly selected from the available. You can use that for now, likely adapted into a separate function.

Saw that but wasn't sure if we wanted to carry that over. This sounds reasonable and also extension-able.

I think I've got enough here to be able to cook something up! I'll open up a WIP PR and ping you on that if I have any questions.

giphy 3

captainsafia commented 9 years ago

OK, I'm gonna be absolutely silly and create a bunch of issues for different parts of this right now. For my own sanity. :)

rgbkrk commented 9 years ago

create a bunch of issues for different parts of this right now

Breaking it up is a great way to go. Thank you!

Wow that pink haired hard working cat. :smile_cat:

captainsafia commented 9 years ago

I'm waiting for you to realize that I'm actually a cat dressed in a human costume.