예제 #1
0
def main ():
    args = parseArgs(desc="EODN-IDMS Download Tool",
                     ptype=common.PARSER_TYPE_DOWNLOAD)
    try:
        rq = ExnodeRESTQuery(args)
        c,ed = get_exdict(rq, None, None,
                          args.recursive,
                          args.ssl)

        if not c:
            logging.info("Found %d files" % c)
        else:
            logging.debug("Found %d files in %d directories" % (c, len(ed)))
        
        if (args.list):
            print "total: %d" % c
            for k,v in ed.iteritems():
                print k+":"
                for n in v:
                    print "\t"+n["name"]
        else:
            download(c, ed, args.visualize, args.verbose)
            
    except Exception as e:
        logging.error("%s" % e)
        sys.exit(1)
예제 #2
0
def main ():
    args = parseArgs(desc="EODN-IDMS Subscription Tool",
                     ptype=common.PARSER_TYPE_PUBSUB)
    rq = ExnodePUBSUBQuery(args)
    listener = Listener(rq, args.visualize,
                        args.verbose, args.list)

    while True:
        listener.start()
        time.sleep(5)
        logging.info("Attempting to reconnect...")
예제 #3
0
      tmpData = inFile
    else:
      print 'Removing trial and step features'
      removeTrialStep(inFile,tmpData,numInstances)
    if randomTree:
      tmpDataSampled = makeTemp('-sampled.arff')
      removeFiles.append(tmpDataSampled)
      for i in range(numRandomTrees):
        if (randomTreeInd is not None) and (i != randomTreeInd):
          continue
        print '*** Random Tree %i' % i
        resample(tmpData,tmpDataSampled,resampleFrac)
        makeTree(tmpDataSampled,useWeka,stayWeight,base,name + '-%i' % i,treeOptions,randomTree,featureFrac)
    else:
      makeTree(tmpData,useWeka,stayWeight,base,name,treeOptions,randomTree,featureFrac)
    print 'Done.'
  finally:
    for f in removeFiles:
      os.remove(f)

if __name__ == '__main__':
  usage = '%prog [options] inFile base name [-- treeOptions]'
  options,args,treeOptions = parseArgs(usage=usage,numArgs=3,studentOptions=False,numInstancesFlag=True)
  inFile = args[0]
  base = args[1]
  name = args[2]
  stayWeight = None

  makeDirs(base,printWarning=False)
  main(inFile,base,name,stayWeight,treeOptions,options.useWeka,options.numInstances)
예제 #4
0
        say('*' * 75)
        for b in builds:
            b.poll()
            if b.is_running() is True:
                say('Still building: {0} url: {1}'.format(b.name, b.baseurl))
                isBuilding = True
                time.sleep(10)
            else:
                # It takes one more poll to get the results:
                b.poll()
                say('Build Done: {0} status: {1}'.format(
                    b.baseurl, b.get_status()))
                # Regardless of what happened, the worker is done, so
                # take it off the list
                if b.get_status() != 'SUCCESS':
                    ret_code += 1
                master_results.append(b)
                builds.remove(b)

    say('Results', banner='*', color='green')
    for build in master_results:
        say('Status: {0}, URL: {1}'.format(build.get_status(), build.baseurl))
    say('All done!')
    return ret_code


if __name__ == '__main__':
    args = parseArgs()
    ret_code = driver(test_file=args.unit_test_file)
    sys.exit(ret_code)
예제 #5
0
                if (randomTreeInd is not None) and (i != randomTreeInd):
                    continue
                print '*** Random Tree %i' % i
                resample(tmpData, tmpDataSampled, resampleFrac)
                makeTree(tmpDataSampled, useWeka, stayWeight, base,
                         name + '-%i' % i, treeOptions, randomTree,
                         featureFrac)
        else:
            makeTree(tmpData, useWeka, stayWeight, base, name, treeOptions,
                     randomTree, featureFrac)
        print 'Done.'
    finally:
        for f in removeFiles:
            os.remove(f)


if __name__ == '__main__':
    usage = '%prog [options] inFile base name [-- treeOptions]'
    options, args, treeOptions = parseArgs(usage=usage,
                                           numArgs=3,
                                           studentOptions=False,
                                           numInstancesFlag=True)
    inFile = args[0]
    base = args[1]
    name = args[2]
    stayWeight = None

    makeDirs(base, printWarning=False)
    main(inFile, base, name, stayWeight, treeOptions, options.useWeka,
         options.numInstances)
예제 #6
0
def main(base, suffix, stayWeight, treeOptions, students, useWeka):
    makeDirs(base, False)
    header, studentData = readStudents(base, students)
    filename = makeTemp('.arff')
    try:
        writeData(header, studentData, filename)
        if len(suffix) > 0:
            if suffix[0] != '-':
                suffix = '-' + suffix
        dest = 'common%s' % (suffix)
        createDT(filename, base, dest, stayWeight, treeOptions, useWeka)
    finally:
        os.remove(filename)


if __name__ == '__main__':
    usage = '%prog [options] base [suffix] [-- treeOptions ...]'
    options, args, treeOptions = parseArgs(usage=usage,
                                           minArgs=1,
                                           maxArgs=2,
                                           studentOptions=False)
    base = args[0]
    if len(args) >= 2:
        suffix = args[1]
    else:
        suffix = ''
    stayWeight = None
    students = getSelectedStudents()
    main(base, suffix, stayWeight, treeOptions, students, options.useWeka)
예제 #7
0
        processStudent(base, dest, i, header, studentData, treeOptions,
                       stayWeight, useWeka)


if __name__ == '__main__':
    from optparse import make_option
    usage = '%prog [options] base [suffix] [-- treeOptions ...]'
    commandLineOptions = []
    commandLineOptions.append(
        make_option('--only',
                    dest='onlyInd',
                    action='store',
                    default=None,
                    help='only run this for student NUM',
                    metavar='NUM',
                    type='int'))
    options, args, treeOptions = parseArgs(usage=usage,
                                           minArgs=1,
                                           maxArgs=2,
                                           options=commandLineOptions)
    base = args[0]
    if len(args) >= 2:
        suffix = args[1]
    else:
        suffix = ''
    stayWeight = None
    students = getSelectedStudents(includeStudents=options.includeStudents,
                                   excludeStudents=options.excludeStudents)
    main(base, suffix, stayWeight, treeOptions, students, options.useWeka,
         options.onlyInd)
예제 #8
0
def main(base,suffix,stayWeight,treeOptions,students,useWeka,onlyInd):
  makeDirs(base,False)
  header,studentData = readStudents(base,students)
  for i,student in enumerate(students):
    if (onlyInd is not None) and (i != onlyInd):
      continue
    if len(suffix) > 0:
      if suffix[0] != '-':
        suffix = '-' + suffix
    dest = 'leaveOneOut-%s%s' % (student,suffix)
    print '-------------------'
    print student
    print '-------------------'
    processStudent(base,dest,i,header,studentData,treeOptions,stayWeight,useWeka)

if __name__ == '__main__':
  from optparse import make_option
  usage = '%prog [options] base [suffix] [-- treeOptions ...]'
  commandLineOptions = []
  commandLineOptions.append(make_option('--only',dest='onlyInd',action='store',default=None,help='only run this for student NUM',metavar='NUM',type='int'))
  options,args,treeOptions = parseArgs(usage=usage,minArgs=1,maxArgs=2,options=commandLineOptions)
  base = args[0]
  if len(args) >= 2:
    suffix = args[1]
  else:
    suffix = ''
  stayWeight = None
  students = getSelectedStudents(includeStudents=options.includeStudents,excludeStudents=options.excludeStudents)
  main(base,suffix,stayWeight,treeOptions,students,options.useWeka,options.onlyInd)
예제 #9
0
import os
from createDT import main as createDT
from common import parseArgs, getSelectedStudents, makeDirs, readStudents, makeTemp, writeData

def main(base,suffix,stayWeight,treeOptions,students,useWeka):
  makeDirs(base,False)
  header,studentData = readStudents(base,students)
  filename = makeTemp('.arff')
  try:
    writeData(header,studentData,filename)
    if len(suffix) > 0:
      if suffix[0] != '-':
        suffix = '-' + suffix
    dest = 'common%s' % (suffix)
    createDT(filename,base,dest,stayWeight,treeOptions,useWeka)
  finally:
    os.remove(filename)

if __name__ == '__main__':
  usage = '%prog [options] base [suffix] [-- treeOptions ...]'
  options,args,treeOptions = parseArgs(usage=usage,minArgs=1,maxArgs=2,studentOptions=False)
  base = args[0]
  if len(args) >= 2:
    suffix = args[1]
  else:
    suffix = ''
  stayWeight = None
  students = getSelectedStudents()
  main(base,suffix,stayWeight,treeOptions,students,options.useWeka)