Merge branch 'django1.7' of mus.cacr.caltech.edu:htsworkflow into django1.7
authorDiane Trout <diane@ghic.org>
Tue, 20 Oct 2015 23:17:47 +0000 (16:17 -0700)
committerDiane Trout <diane@ghic.org>
Tue, 20 Oct 2015 23:17:47 +0000 (16:17 -0700)
1  2 
htsworkflow/submission/aws_submission.py

index 06dbd601b0a1b6e52c7b5cec4a5109671755fd31,d6f3cdb9133a9f2815745b692b6fa1ceb34234e2..0b76b04d42d53e4b859bbde2004de66a90454825
@@@ -61,12 -61,32 +61,12 @@@ class AWSSubmission(Submission)
  
                      item = response['@graph'][0]
                      creds = item['upload_credentials']
 -                    self.run_aws_cp(metadata['submitted_file_name'], creds)
 +                    run_aws_cp(metadata['submitted_file_name'], creds)
                  else:
                      LOGGER.info('%s already uploaded',
                                  metadata['submitted_file_name'])
  
  
 -    def run_aws_cp(self, pathname, creds):
 -        env = os.environ.copy()
 -        env.update({
 -            'AWS_ACCESS_KEY_ID': creds['access_key'],
 -            'AWS_SECRET_ACCESS_KEY': creds['secret_key'],
 -            'AWS_SECURITY_TOKEN': creds['session_token'],
 -        })
 -        start = time.time()
 -        try:
 -            subprocess.check_call(['aws', 's3', 'cp', pathname, creds['upload_url']], env=env)
 -        except subprocess.CalledProcessError as e:
 -            LOGGER.error('Upload of %s failed with exit code %d', pathname, e.returncode)
 -            return
 -        else:
 -            end = time.time()
 -            LOGGER.info('Upload of %s finished in %.2f seconds',
 -                        pathname,
 -                        end-start)
 -
 -
      def get_metadata(self, analysis_node):
          # convert our model names to encode project aliases
          platform_alias = {
          for row in results:
              if 'platform' in row:
                  row['platform'] = platform_alias[row['platform']]
+             if 'read_length' in row:
+                 row['read_length'] = int(row['read_length'])
              flowcell_details = {}
              for term in ['machine', 'flowcell', 'lane', 'barcode']:
                  if term in row:
                  row['flowcell_details'] = [flowcell_details]
  
          return results
 +
 +def run_aws_cp(pathname, creds):
 +    env = os.environ.copy()
 +    env.update({
 +        'AWS_ACCESS_KEY_ID': creds['access_key'],
 +        'AWS_SECRET_ACCESS_KEY': creds['secret_key'],
 +        'AWS_SECURITY_TOKEN': creds['session_token'],
 +    })
 +    start = time.time()
 +    try:
 +        subprocess.check_call(['aws', 's3', 'cp', pathname, creds['upload_url']], env=env)
 +    except subprocess.CalledProcessError as e:
 +        LOGGER.error('Upload of %s failed with exit code %d', pathname, e.returncode)
 +        return
 +    else:
 +        end = time.time()
 +        LOGGER.info('Upload of %s finished in %.2f seconds',
 +                    pathname,
 +                    end-start)