engineer-man / piston

A high performance general purpose code execution engine.
https://emkc.org/run
MIT License
1.94k stars 250 forks source link

Adding multiple packages at once #689

Open SammyWhamy opened 1 month ago

SammyWhamy commented 1 month ago

I would like to see a way to install multiple packages at once. Currently, i run this in docker, and i dont want to make like ~25 api requests just to install the packages. I know you can do something with building the container yourself and adding them, but I don't want to have to maintain the image myself. I don't mind the install time, but I'd just like an easy way to automate installing a list of packages.

I've also seen stuff about a specfile, which I can't really find any docs on aside from using them in the build step. It would be great if piston could be configured to read the specfile on startup!

karastoyanov commented 1 month ago

I had the same use case. My solution was to write a Python script which executes once the container is deployed and sends the POST requests to the Piston endpoint in order to install the runtimes envs.

I am fallowing in case another alternative exists.

SammyWhamy commented 1 month ago

Yes this is my seemingly the only option currently. If there was a way to at least do multiple packages in one api request, that would be much more viable. But as per #270 this was rejected and instead implemented in the cli.

superdinmc commented 1 month ago

There is absolutely no reason to worry about API request count or bandwidth when you're requesting in the same server. although this might be useful in multi-server setup.

SammyWhamy commented 1 month ago

It's not about throughput, it's about the fact I'd have to use some other language to, for example, loop over an array of package specifications to then execute them one by one. Piston seems to have a nice thing doing exactly this (specfile) but currently seems to be only usable in the build stage (Please correct me if im wrong on this). It would be very nice if this can be used on startup too. This way I'd just need to commit one specfile, which would also make sure I'm up to date on versions and get new packages once they are available in piston