Beispiel #1
0
def run_reviewer_batch_job(reviewer_db, session, checks_rbj, prod_data):

    # Check out a Data Reviewer extension license
    arcpy.CheckOutExtension("datareviewer")

    arcpy.env.overwriteOutput = "true"

    # Execute Reviewer Batch Job function
    res = arcpy.ExecuteReviewerBatchJob_Reviewer(reviewer_db, session, checks_rbj, prod_data)

    arcpy.CheckInExtension("datareviewer")
Beispiel #2
0
def DRrun(str_dr_db, str_filename_rbj, str_data_db):
    print "DRrunner_execute()", str_dr_db, str_filename_rbj, str_data_db

    # Description: Executes a reviewer batch job
    # Requirements: Production Mapping extension

    arcpy.env.overwriteOutput = "true"

    # Delete, and then Create, the DR-session, to make sure it's clean.
    print "Starting DR session"
    str_session = "DRrunner"
    try:
        arcpy.DeleteReviewerSession_Reviewer(str_dr_db, str_session)
    except:
        print "   Session didn't exist ..."
    print "creating session"
    drs_session = arcpy.CreateReviewerSession_Reviewer(str_dr_db, str_session)
    #Session = arcpy.CreateReviewerSession_Reviewer(Reviewer_workspace , "TestSession", "Session 1 : Session 1")
    print "   DR session Create - Success : ", str(drs_session)

    # Execute Reviewer Batch Job function
    print "Executing DR batch job: " + str_filename_rbj
    res = arcpy.ExecuteReviewerBatchJob_Reviewer(str_dr_db, drs_session,
                                                 str_filename_rbj, str_data_db)
    print "   DR execute rbj - Success"

    # get the output table
    print "Show results:"
    tbl = res.getOutput(0)
    # query the table
    for row in arcpy.da.SearchCursor(tbl, ("*")):
        for i in range(len(row)):
            print "    " + str(i) + " : " + str(row[i])
        str_batch_run_id = row[1]

    # Check in the Data Reviewer extension
    arcpy.CheckInExtension("datareviewer")

    return str_batch_run_id

    # ------ End def DRrun() -------------


# Music that accompanied the coding of this script:
#   Coralie Clement - Salle des pas perdus
Beispiel #3
0
# Create a new session:
session_name = ("%s_%s_%s" % (start.year, start.month, start.day))
print session_name
session = str(arcpy.CreateReviewerSession_Reviewer(reviewer_db, session_name))
print session
writeMsg("\nSession Id:  " + session)

# Set loop to run and log the batch events, or errors if present.
for check in rbj:
    try:
        use_rbj = rbj_path + check
        now = datetime.datetime.now()
        writeMsg("\nStarting Batch job:  " + check + " at \n" + str(now)[:-7])
        res = arcpy.ExecuteReviewerBatchJob_Reviewer(reviewer_db, session,
                                                     use_rbj, production_db,
                                                     area, "")
        now = datetime.datetime.now()
        arcpy.Delete_management("in_memory")
        writeMsg("\nFinished at:  " + str(now)[:-7])
    except Exception as err:
        writeMsg("\n Batch job did not work.\n\n")
        writeMsg(str(err))

# Set variables to run Locate Events along Route tool.
# Start by making a copy of the LRSN Road Network that is filtered with the time stamp def query.
arcpy.MakeFeatureLayer_management(
    production_db + "/INVDB.LRSN_RoadNetwork",
    'useMe',
    where_clause=
    "(FromDate is null or FromDate<=CURRENT_TIMESTAMP) and (ToDate is null or ToDate>CURRENT_TIMESTAMP)"
Beispiel #4
0
session_name = ("%s_%s_%s" % (start.year, start.month, start.day))
print session_name
session = str(arcpy.CreateReviewerSession_Reviewer(reviewer_db, session_name))
print session
writeMsg("\nSession Id:  " + session )

# Set loop to run and log the batch events, or errors if present.
for check in rbj:
    try:
        use_rbj = rbj_path + check
        now = datetime.datetime.now()
        writeMsg("\nStarting Batch job:  " + check + " at \n" + str(now)[:-7])
        res = arcpy.ExecuteReviewerBatchJob_Reviewer(
            reviewer_db,
            session,
            use_rbj,
            production_db,
            "",
            "",
            production_workspaceversion)
        now = datetime.datetime.now()
        arcpy.Delete_management("in_memory")
        writeMsg("\nFinished at:  " + str(now)[:-7])
    except Exception as err:
        writeMsg("\n Batch job did not work.\n\n")
        writeMsg(str( err ))

# Set variables to run Locate Events along Route tool.
# Start by making a copy of the LRSN Road Network that is filtered with the time stamp def query.
arcpy.MakeFeatureLayer_management(
    production_db +
    "/INVDB.LRSN_RoadNetwork",