I’m working on a project that will need to load python code files dynamically from GitHub on launch. Here’s what it needs to look like:
User asks us to launch an instance for them and provides us with a GitHub url
We have an existing docker with our own python code (a server) that will be using those files from GitHub
We need to launch the docker with our own code, but subbing in parts that we got from the users GitHub, basically creating a server with half our code, half user code
In other words, we need to launch a docker that has some pre planned code from us, and some dynamic code from the user.
Any ideas how to do this? I’ve seen many examples of docker files that load code from GitHub, but I’m having a hard time figuring out how to make it half our code, and half code dynamically from GitHub on run.
Related
MyBinder and Colaboratory are feasible to allow people to run our examples from the website directly in their browser, without any download required.
When I work on the Binder, our data to be loaded takes a huge time. So, I need to run python code on the website directly.
I'm not sure whether I totally get the question. If you want to avoid having to download the data from another source, you can add the data into you git repo which you use to start Binder. It should look something like this: https://github.com/lschmiddey/book_recommender_voila
However, if your dataset is too big to be uploaded to your git repo, you have to get the data onto the provided Binder server somehow. So you usually have to download the data onto your Binder Server so that other users can work on your notebook.
I want to run a python script continuously on a container instance. I could create a docker container and update my private registry, but it seems like overkill to have to make a new image every time I change the source code. I like how Azure WebApps can link to a git repo and automatically sync the source when it is updated and re-deploy the app. Is it possible to do something similar like this out of the box without making a python web app (non-flask, etc)?
I could technically run my script in flask and just have the web server do nothing (or even close the port) but this seems unnecessary.
Is it possible to do something similar like this out of the box without making a python web app (non-flask, etc)?
I am afraid there is no such out of box way to resolve this question.
Rebuilding image when the code changes is the canonical approach. Build the python script continuously with container instance is different from the Azure WebApps. We have to update the image to the docker container so that could be updated to the private registry.
Besides, if we build/deploy pythonApp with private agent, it is not wasteful at all if done right. pythonApp code should be COPY'd into your image as the final step. This means rebuilding will be very fast as all other steps will be cached. If you only have a few kB of source code changes it will only result in a single new layer of a few kB. Stopping and starting containers is also very light weight. There is nothing to worry about in following this approach.
But, for the hosted agent, it is indeed a problem. There is a user voice on Developer Community and a topic on github about it.
Hope this helps.
This question isn't related to some specific code, but rather implementation:
This may seem like a dumb question but does anyone know how to use a domain name to host a python script that runs continuously? Some examples of how this would be used: as a script that handles data or a server for a game. If this is unreasonable, is there some other way to have a python script run continuously online?
You can run the script at Link1 or if you want to run it on your machine, you can create a page and put the script there can be with flask (and integrate it with flask) and mount it on a server and do not put it as a website with graphics but as a website that runs it Link2.
I have a python application with various dependencies that get resolved during docker-compose build command. A docker image is created, and when run it's a simple REST API that I can access via a browser.
I want to send a GET request and then debug the corresponding method in VS Code. However I'm struggling to get this to work. I'm able to get the docker image running from within VS Code (using Remote-Containers: Open Folder in Container option). I can see the API is up and changes in the code are reflected live.
However I'm struggling to get the debugging part to work.
When I start debugging, I'm asked to provide a Debug Configuration and I'm not sure what the right one to pick or how to set one up....
Please see the documentation on debugging on how to create a debug configuration.
I have a standalone python script that I currently run from the command line, that I would like to use from a static webpage. I've currently deployed it to heroku, and can run it from console in a dyno, but that's as far as I've gotten.
My script takes .txt files as input, and generates a .csv file as output. I would like to use the tag to request the input file from the user on a form page, pass that file to the python script and execute the script, then make the output file available for user download.
I realize this is a broad question, so I'm not really asking for a step by step solution, but rather an overview of how this needs to be handled, and maybe some links to appropriate docs/tutorials. I've been searching google for hours, but most of the results are framework based webapp tutorials, which is not what I need at this time.
Cheers