Permalink
Browse files

Add a better README

  • Loading branch information...
1 parent 8eafeaa commit ecde98bb3c4002198c907d8632f8fffee4842b4e @oldpatricka oldpatricka committed Jan 10, 2013
Showing with 60 additions and 0 deletions.
  1. +60 −0 README.md
View
@@ -0,0 +1,60 @@
+PIDantic
+========
+
+This library is an abstraction for communicating with child processes.
+The processes can run via supervisord or within an ION
+container. This code should provide a seamless interface to both
+allowing the user to start/stop/monitor processes without the concern
+of how the processes were run.
+
+The specifics of communicating with the different types of processes
+is handled in PIDantic drivers. The drivers may implement any blocking
+IO with gevent.
+
+Using PIDantic
+--------------
+
+To use PIDantic, you must create a PIDantic factory, and then you can
+use this factory to start processes.
+
+### SupervisorD
+
+An example of how to start an interact with a process:
+
+ from pidantic.supd.pidsupd import SupDPidanticFactory
+
+
+ # Create our factory
+ persistence_directory = "/tmp"
+ persistence_name = "pidantic_test"
+
+ factory = SupDPidanticFactory(directory=persistence_directory,
+ name=persistence_name)
+
+
+ # Start a process
+ cmd = "sleep 100"
+ name = "sleeper"
+ dir = persistence_directory
+
+ pid = self.factory.get_pidantic(command=cmd, process_name=name,
+ directory=dir)
+ pid.start()
+
+
+ # Check process status
+ processes = factory.reload_instances()
+ factory.poll()
+
+ # Print status of each process
+ for name, process in processes.iteritems():
+ print "Process %s has status %s" % (name, process.get_status())
+
+
+ # Terminate all processes
+ for name, process in processes.iteritems():
+ process.cleanup()
+
+
+ # Shut down the factory
+ factory.terminate()

0 comments on commit ecde98b

Please sign in to comment.