Project

General

Profile

Example running a project using the API


import samweb_client

samweb = samweb_client.SAMWebClient(experiment='minerva/dev')

def testProject(defname="def_sam_20110902133809", appFamily="reconstructed", appName="reco", appVersion="v10r4p1"):

    projectname = samweb.makeProjectName(defname)
    projectinfo = samweb.startProject(projectname, defname)
    projecturl = projectinfo["projectURL"]
    print "Project name is %s" % projectinfo["project"]
    print "Project URL is %s" % projecturl

    deliveryLocation = None # set this to a specific hostname if you want - default is the local hostname
    cpid = samweb.startProcess(projecturl, appFamily, appName, appVersion, deliveryLocation)
    print "Consumer process id %s" % cpid
    processurl = samweb.makeProcessUrl(projecturl, cpid)

    while True:
        try:
            newfile = samweb.getNextFile(processurl)['url']
            print "Got file %s" % newfile
        except samweb_client.NoMoreFiles:
            print "No more files available" 
            break

        samweb.releaseFile(processurl, newfile)
        print "Released file %s" % newfile

    samweb.stopProject(projecturl)
    print samweb.projectSummaryText(projecturl)
    print "Project ended" 

if __name__ == '__main__':

    testProject()