Esempio n. 1
0
def main(parser):
    args = parser.parse_args()

    if not args.names:
        assert args.dataName, 'Must pass dataName if not using -n option'

    #set up connection to service
    sal    = ServiceAccessLayer(args.host,args.port)
    #get datastore 
    dstore = sal.get_analysis_job_datastore(args.jobNumber)
    #loop through data
    for uuid,dsfile in dstore.files.items():
        if args.names:
            #print the attribute values
            print '\t'.join([fmt(getattr(dsfile,a))
                             for a in attrs])    
        elif dsfile.name in args.dataName:
            #cp file to outdir
            ofile = '{o}{s}{n}'.format(o=args.outDir,
                                       s=os.path.sep,
                                       n=os.path.basename(dsfile.path))
            copy(dsfile.path,ofile)
            print '\t'.join([fmt('\'%s\''%dsfile.name),'=>',ofile])

    return