Ich habe pm2
für meine Node.js-Skript verwendet und ich liebe es.
Jetzt habe ich ein Python-Skript, das Streaming-Daten auf EC2 sammeln. Manchmal bombardiert das Skript und ich möchte, dass sich ein Prozessmanager wie PM2 neu startet.Wie führe ich ein Python-Skript wie pm2 für nodejs
Gibt es etwas Ähnliches wie PM2 für Python? Ich habe herumgesucht und konnte nichts finden.
Hier ist mein Fehler
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 430, in filter
self._start(async)
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 346, in _start
self._run()
File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 286, in _run
raise exception
AttributeError: 'NoneType' object has no attribute 'strip'
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90:
Es ist ein einfaches Datenskript sammeln
class StdOutListener(StreamListener):
def on_data(self, data):
mydata = json.loads(data)
db.raw_tweets.insert_one(mydata)
return True
def on_error(self, status):
mydata = json.loads(status)
db.error_tweets.insert_one(mydata)
if __name__ == '__main__':
#This handles Twitter authetification and the connection to Twitter Streaming API
l = StdOutListener()
auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
stream = Stream(auth, l)
#This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
stream.filter(follow=[''])
Dass ich es möchte nur selbst neu zu starten, falls etwas passiert.
Darf ich vorschlagen, http://supervisord.org/ –