Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Sequencer on gCloud #755

Open
tech4GT opened this issue Feb 9, 2019 · 38 comments
Open

Running Sequencer on gCloud #755

tech4GT opened this issue Feb 9, 2019 · 38 comments
Labels

Comments

@tech4GT
Copy link
Member

tech4GT commented Feb 9, 2019

Current Service

  • We are running a google cloud function which processes the image and returns the output
// This is the current script
/**
 * Responds to any HTTP request.
 *
 * @param {!express:Request} req HTTP request context.
 * @param {!express:Response} res HTTP response context.
 */
const sequencer = require('image-sequencer')();

exports.helloWorld = (req, res) => {

    const img = req.query.url,
        sequence = req.query.sequence;
  
    sequencer.loadImages(img, () => {
        sequencer.importString(sequence);
        sequencer.run(out => {
            res.status(200).send({ data: out });
        });
    });
}

Process:

screen shot 2019-02-10 at 2 43 23 am

screen shot 2019-02-10 at 2 43 32 am

screen shot 2019-02-10 at 2 43 46 am

Ideas

  • Parallelize the processing of images using more cloud functions or maybe deploying on cloud engine
  • Optimize the core APIs to make the processing faster and more memory efficient
  • Try to run Image sequencer on a stream based input
@tech4GT
Copy link
Member Author

tech4GT commented Feb 9, 2019

cc @jywarren @icarito

@jywarren
Copy link
Member

jywarren commented Feb 9, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 9, 2019

Sure!

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@harshkhandeparkar
Copy link
Member

@jywarren I checked it out, It took around 2mins to load the page itself. I haven't checked the dataURI it returned is there any way to ckeck it out? Also will it work for any steps?

@jywarren
Copy link
Member

Anyone should be able to set up a free trial Google cloud account... Try it out! I think what I wrote about redirecting could work to view the dataurl.

@jywarren
Copy link
Member

Is there a way to git track the script?

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

I think this is working!

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

For some reason it is loading a landing page though?
screen shot 2019-02-10 at 9 45 48 pm

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Oh, I already fixed it to redirect, we can do a res.redirect(out) to redirect to the image

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Yeah, I'll figure out the redirect right now! But this looks promising!!
So what are our next steps?
I mean should I jump to core optimizations now?

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

@jywarren I updated it!

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

@jywarren redirect is now working, you can try it out at the previous url! 🎉
Also, can you explain this process to me in a little more detail?
I think we can send the execution time as a part of json response from the cloud function but how do I make the copy of gc function run on the github repo?

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Okay so do we make a new repository for this, or should I add this script to is-app?

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

And as new code is pushed into image-sequencer we need to invoke the cloud function, correct? And where do we store the performance results?

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Okay, will do that right now!

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

I'll also add the performance to response!
But maybe you can help with annotating runtimes?

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

@jywarren I don't have permission to create repository for the project 😅

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

We can just track speeds in PR comments as improvements are made. Actually I guess maybe you want to link it to your remote is branch directly? So you can test the optimizations as directly as possible?

On Sun, Feb 10, 2019, 12:34 PM Varun Gupta @.*** wrote: I'll also add the performance to response! But maybe you can help with annotating runtimes? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#755 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ34O_k5OyiAEWdy8rg_Em6WC9Dz5ks5vMFf9gaJpZM4ayvPE .

SO is this done using some sort of bot which runs the function and comments the runtime in the pr?
Sorry if I am asking stupid questions, I don't really have a lot of experience in this area 😅

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Feb 10, 2019

@tech4GT I think he meant we could give progress reports in the comments. 😅. Not sure though.
Edit: Sorry for commenting without any real reason. I was actually following the discussion. I'm quite pumped up here

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

@tech4GT I think he meant we could give progress reports in the comments.

Do you mean do it manually?

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@jywarren
Copy link
Member

#216

@jywarren
Copy link
Member

I just mean we should keep an empirical log of runtime so we can track progress quantitatively... However you want to do it!

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Oh, Got it!!

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Also can you please grant me the permission to create cloud repositories on public-lab project, I'll link the is-app to it then, so that we can get the cloud function from there.
Also what track should we follow now? As in should I now dive into optimizations? Or we are thinking of deploying to app-engine??

@jywarren
Copy link
Member

Let's do optimization and webgl now. I think we should demonstrate the whole intended workflow and then look at the serverless options later. This already works!

@tech4GT
Copy link
Member Author

tech4GT commented Feb 10, 2019

Okay awesome! I'll dive into that from tomorrow! (it's pretty late here lol)

@jywarren
Copy link
Member

jywarren commented Feb 10, 2019 via email

@icarito
Copy link
Member

icarito commented Feb 20, 2019

I had missed this, very cool indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants