Python workers in Rails [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm building rails application, I have workers from other project, they called ironworker and written on Python. Is it possible to use this workers in Rails application?
As one of solution, I'm going to use other worker - resque, but can I execute Python scripts?
Thanks for help, I have no idea from what I should start

As I understand from the docs of ironworker, python workers can be run from command line.
exec 'hello_worker.py'
This post explain how you can do it:
Calling shell commands from Ruby.
For example you can call python workers in your rescue worker:
class ImageConversionJob
def work
system("exec 'hello_worker.py'")
end
end

Related

How do I prevent users's shutdown in WINDOWS? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
I want to design a program that can stop the user from shutting down.
At first I tried to create an unsaved text document, but the user still had the option to force a shutdown. I also know that the shutdown -a commands can prevent a shutdown, so I wrote the following simple python program:
from os import system
while True:
system('shutdown -a')
But when it is running, the system can still shut down successfully, why is this? I hope this shutdown restriction can be turned on or off at any time.It would be nice if you could do this in python,thank you!

How to prevent your free tier heroku app from idling(python/django) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is there any way, through code, to prevent your app from idling? I'm thinking something like what is being done here. How to do this through code, but in python/django as that is what my app is done in, i.e. what is the equivalent in python to Node's setInterval. What are the disadvantages of using a pinging service over doing it through code(other than if the site goes down your app wont get pinged). Can you recommend a good pinging service? Thanks in advance.
You cannot do it from within the application. It needs to be woken up "externally". This can be just another Heroku application but that kind of defeats the purpose. There are some Heroku add ons that allow you to monitor your website thus also pinging it in regular intervals.
For example:
https://elements.heroku.com/addons/newrelic
With this your website would always stay awake.
The article you linked is imo more complicated than necessary. If you own a VPS you could host your website there. You could also write a curl command save it as a shell script and call it from cron (https://help.ubuntu.com/community/CronHowto).

Run command in background with Fabric [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to run a background script with Fabric using Bash's '&' operator. Is there a reason the following doesn't work? I executed this command on the server itself and it runs fine.
#task
def run_script():
sudo('sh /home/ubuntu/wlmngcntl.sh start &', user='myuser')
I don't want to use something heavy like Celery to do this simple thing. I don't need to capture the output at all, all I want is for the task to execute this and return after.
This isn't a Fabric thing, but a Linux thing. When you close a session, the processes connected to that session are terminated.
This question has a lot of info... https://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session
You could use the following (from that answer)
sudo('nohup sh /home/ubuntu/wlmngcntl.sh start &', user='myuser')

Does anybody know how to run parallel a Python application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to use Python for my project but I need to distribute the computation on a set of resources.
You can try with pyCOMPSs, which is the python version of COMP superscalar.
More info here
With this programming model you define which methods are candidate to be executed remotely defining the direction of the method parameters (IN OUT or INOUT). Then the main code is programmed in a sequential fashion and the runtime analyses dependencies between these methods detecting which can be executed in parallel. The runtime also spawn the exectution transparently to the remote hosts and do all data transfers.

Best way to trigger a Node-RED flow from python script [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm running Node-RED on a raspberry pi. I want to trigger a flow at the end of a python script I'm running on the same rpi. What's the easiest input node to trigger and what would be an example of the python code to use with it? I'd like to pass a string variable back
Taking best to be easiest then the http-in node is probably best
And using something like this will work:
import urllib2
urllib2.urlopen("http://localhost:1880/start").read()
Where the http-in node has been configured to listen on /start

Categories