oz icon indicating copy to clipboard operation
oz copied to clipboard

Add Oz server main function

Open aiba opened this issue 3 years ago • 5 comments

For my team, all the dependencies of Oz means we can't depend on it directly from our main project.

The way I would like to use Oz is to just run it in a separate JVM and send view! commands to it remotely. I'll generate the plots from my regular project REPL, where all the data is, but then just send a remote view! command to Oz to render it.

Is this something that Oz already supports, or should I just create my own mini server wrapper for this?

This would also let us have the oz-server run on an ec2 instance that my teammates can see as well, for another way to share plots.

I think this is preferable to #73 for managing dependencies.

aiba avatar Sep 19 '20 14:09 aiba

Hi @alba! Thanks for making this suggestion.

Is the problem that there's a dependency conflict? Or just that you don't feel comfortable adding so many dependencies to your production builds?

Assuming the latter (and that you're using clj), you can add Oz just for your REPL sessions with -Sdeps {:deps {metasoarous/oz {:mvn/version "1.6.0-alpha26"}}}, or add an alias that does that for you. Similarly with lein, you could create a profile for taking care of this.

If this is a dependency conflict issue, I would be open to adding some functionality that would enable you to run Oz in a separate process and send plots to it. You would miss out on some of the features this way (particularly some of the hiccup compilation features), but if you're just interested in core plotting utilities, that might be fine.

Please let me know what you think.

Thanks again!

metasoarous avatar Sep 22 '20 18:09 metasoarous

Is the problem that there's a dependency conflict? Or just that you don't feel comfortable adding so many dependencies to your production builds?

It's a comfort thing. Our software is a realtime financial transaction system and we try to manage our dependencies pretty carefully, and generally keep external dependencies as minimal as possible.

Yes, we could add Oz only for dev profiles, but we also try to keep our dev REPLs as similar as possible to the production environment.

I actually made a little server to do this and it's been working great for us. So this issue is no longer preventing me from using and enjoying Oz, but perhaps it might be worth considering whether the separate-JVM method of using Oz is of interest to other users to the point where it's worth baking something into Oz itself.

aiba avatar Sep 26 '20 17:09 aiba

Hey @alba! This is great! Thanks for sharing.

I do think it's worth adding support for something like this. I've started work on a main function for doing various things from the command line, and this would be a great and relatively simple addition. So thanks for making the suggestion.

What would you think about a little oz-client companion library that does the packing/sending work? Could also re-implement the function application logic so you can use function components in your hiccup, which wouldn't require any extra deps. Please let me know if that's something you'd find useful.

Thanks again!

metasoarous avatar Sep 29 '20 22:09 metasoarous

What would you think about a little oz-client companion library that does the packing/sending work?

Yes, I would totally use that!

aiba avatar Oct 05 '20 13:10 aiba

Excellent :-)

metasoarous avatar Oct 05 '20 18:10 metasoarous