Actually implement the code to loop over a list of runfolders
authorDiane Trout <diane@caltech.edu>
Thu, 4 Feb 2010 20:30:09 +0000 (20:30 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 4 Feb 2010 20:30:09 +0000 (20:30 +0000)
on the command line.

scripts/mark_archived_data

index 6d72ab2b0d71da672052a7e98fb71d7b6cf47a49..288ec1ac00c1f05d327c48a0cb4cf735e16d6f3c 100755 (executable)
@@ -36,24 +36,25 @@ def construct_parser():
     return parser
 
 
-def update_db(root_url, flowcell, serial, debug=False):
+def update_db(root_url, flowcells, serial, debug=False):
     """
     Creates link between flowcell and storage device over http
     """
-    url = urlparse.urljoin(root_url, '%s/%s/' % (flowcell, serial))
-    
-    req = urllib2.Request(url)
-    try:
-        response = urllib2.urlopen(req)
-    except urllib2.URLError, e:
-        print 'ERROR - HTTP OUTPUT (Return Code: %s); use -v/--verbose for more details.' % (e.code)
-        if debug:
-            print e.read()
-        sys.exit(e.code)
+    for fc in flowcells:
+        url = urlparse.urljoin(root_url, '%s/%s/' % (fc, serial))
+        
+        req = urllib2.Request(url)
+        try:
+            response = urllib2.urlopen(req)
+        except urllib2.URLError, e:
+            print 'ERROR - HTTP OUTPUT (Return Code: %s); use -v/--verbose for more details.' % (e.code)
+            if debug:
+                print e.read()
+            sys.exit(e.code)
+        
+        print "DB Update of %s & %s succeeded" % (fc, serial)
+        print response.read()
     
-    print "DB Update of %s & %s succeeded" % (flowcell, serial)
-    print response.read()
-
 
 def process_args(parser):
     """
@@ -97,9 +98,6 @@ def process_args(parser):
         parser.error('please specify a  --flowcell or list of runfolder archives\n'\
                      'for archival. I need something to do.')
 
-    print flowcells
-    sys.exit(1)
-    
     # Update db records
     if options.device is not None:
         serial = get_hd_serial_num(options.device)