コード例 #1
0
        configPath = os.getenv("DIFXROOT") + "/conf/difxdb.ini"

        config = DifxDbConfig(configPath, create=True)

        # try to open the database connection
        connection = Connection()
        connection.type = config.get("Database", "type")
        connection.server = config.get("Database", "server")
        connection.port = config.get("Database", "port")
        connection.user = config.get("Database", "user")
        connection.password = config.get("Database", "password")
        connection.database = config.get("Database", "database")
        connection.echo = False

        dbConn = Schema(connection)
        session = dbConn.session()
        
	try:
		experiment = getExperimentByCode(session, expCode)
	except:
		raise Exception("Unknown experiment")
		sys.exit

	types = ""
	for expType in experiment.types:
		types += expType.type

	print "---------------------------------------"
	print "Summary information for %s" % (expCode)
	print "---------------------------------------"
コード例 #2
0
ファイル: prepDifx.py プロジェクト: pwc/difx-svn2git-try4
    configName = 'difxdb.ini'

    #  check for DIFXROOT environment
    if (os.getenv("DIFXROOT") == None):
        sys.exit("Error: environment variable DIFXROOT must be defined.")
    settings["difxRoot"] = os.getenv("DIFXROOT")
    settings["configFile"] = settings["difxRoot"] + "/conf/" + configName

    # read the configuration file
    config = DifxDbConfig(settings["configFile"], create=False)
    connection = Connection()
    connection.type = config.get("Database", "type")
    connection.server = config.get("Database", "server")
    connection.port = config.get("Database", "port")
    connection.user = config.get("Database", "user")
    connection.password = config.get("Database", "password")
    connection.database = config.get("Database", "database")
    connection.echo = False

    dbConn = Schema(connection)

    if args.update:
        expUpdate()
    #elif args.finalize:
    #    expFinalize()
    else:
        expPrepare(code)

    print "DONE"