[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

extras-buildsys/client client.py,1.3,1.4



Author: dcbw

Update of /cvs/fedora/extras-buildsys/client
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17850/client

Modified Files:
	client.py 
Log Message:
2005-06-29  Dan Williams <dcbw redhat com>

    * Add the ability to search jobs on current job status from plague-client




Index: client.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/client/client.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- client.py	29 Jun 2005 05:22:55 -0000	1.3
+++ client.py	29 Jun 2005 20:27:12 -0000	1.4
@@ -91,20 +91,28 @@
         print "Package %s enqueued." % package
 
 
-def list_own_jobs(server, email):
+def list_jobs(server, email, status=None):
     """
-    Get a list of the jobs the current user owns.
+    List jobs by email, status, or both.
     """
 
+    args = {}
     try:
-        args = { 'email' : email }
-        jobs = server.list_jobs(args)
+        args['email'] = email
+        if status:
+            args['status'] = status
+        (e, msg, jobs) = server.list_jobs(args)
     except (M2Crypto.SSL.SSLError, socket.error), e:
         print "Error connecting to build server: '%s'" % e
         return
 
-    for job in jobs:
-        print job
+    if e == -1:
+        print msg
+    elif len(jobs) == 0:
+        print "No jobs found that match the search criteria."
+    else:
+        for job in jobs:
+            print job
 
 
 def kill(server, email, jobid):
@@ -231,6 +239,8 @@
         print "      <command> is one of:"
         print "      build [package_name] [cvs_tag | srpm_path] [target]"
         print "      list"
+        print "      list <status>"
+        print "      list <email> <status>"
         print "      kill <jobid>"
         print "      update_clients"
         print "      list_clients"
@@ -262,7 +272,18 @@
         except CommandException, e:
             print e.message
     elif cmd == 'list':
-        list_own_jobs(server, email)
+        status = None
+        if len(sys.argv) == 2:
+            pass
+        elif len(sys.argv) == 3:
+            status = sys.argv[2]
+        elif len(sys.argv) == 4:
+            email_addr = sys.argv[2]
+            status = sys.argv[3]
+        else:
+            print "Error: invalid command format"
+            sys.exit(1)
+        list_jobs(server, email, status)
     elif cmd == 'kill':
         if len(sys.argv) < 3:
             print "Error: need a job UID to kill"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]