PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/api/sample_dataset_update_status.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 22 lines | 19 code | 2 blank | 1 comment | 0 complexity | 4e661c5423c30539d9837098376673ad MD5 | raw file
 1#!/usr/bin/env python
 2
 3
 4import os, sys, traceback
 5sys.path.insert( 0, os.path.dirname( __file__ ) )
 6from common import display
 7from common import submit
 8from common import update
 9try:
10    data = {}
11    data[ 'update_type' ] = 'sample_dataset_transfer_status'
12    data[ 'sample_dataset_ids' ] = sys.argv[3].split(',')
13    data[ 'new_status' ] = sys.argv[4]
14except IndexError:
15    print 'usage: %s key url sample_dataset_ids new_state [error msg]' % os.path.basename( sys.argv[0] )
16    sys.exit( 1 )
17try:
18    data[ 'error_msg' ] = sys.argv[5]
19except IndexError:
20    data[ 'error_msg' ] = ''    
21print data
22update( sys.argv[1], sys.argv[2], data, return_formatted=True )