Exemplo n.º 1
0
import os
import sys

# Add relative path libraries
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.abspath(os.path.sep.join([SCRIPT_DIR, "..", "lib"])))

import Repository

if __name__ == "__main__":
    import argparse
    parser = argparse.ArgumentParser(
        description='Attach an app to an existing sample')
    parser.add_argument('-s',
                        '--sample',
                        type=str,
                        dest="sample",
                        required=True,
                        help='name of sample')
    parser.add_argument('-a',
                        '--app',
                        type=str,
                        dest="app",
                        required=True,
                        help='name of app')

    args = parser.parse_args()

    Repository.AddSampleApp(args.sample, args.app)
Exemplo n.º 2
0
 elif args.lims:
     samples, relationships = Repository.ConfigureSamplesFromLIMSFile(projectName, args.lims)
 elif args.name:
     if not args.app:
         print "if you specify a sample, you need to specify an app"
         sys.exit(1)
     # build up the variables we need to create the sample(s) and any specified relationships
     sampleName = args.name
     appName = args.app
     samples = set()
     relationships = set()
     sample = Repository.AddSample(sampleName, projectName)
     # keep track of the samples we build so we can report on them
     if sample:
         samples.add(sample)
     Repository.AddSampleApp(sampleName, appName)
     if args.related or args.relationship:
         if not args.related or not args.relationship:
             print "to add a relationship need both related sample and relationship name"
             sys.exit(1)
         # if a relationship has been specified, create the target sample...
         toSample = args.related
         relationshipName = args.relationship
         sample = Repository.AddSample(
             sampleName=toSample,
             projectName=projectName
         )
         if sample:
             samples.add(sample)
         # ... and then create the relationship
         relationship = Repository.AddSampleRelationship(