Copy Job Files (Topographic Production)

摘要

Copies Workflow Manager (Classic) job files to and from a local machine and a shared directory for processing.

警告:

This tool is designed to be run as a step in a Workflow Manager (Classic) workflow. Running this tool outside of Workflow Manager (Classic) does not honor all Workflow Manager (Classic) constraints such as job assignment, dependencies, or holds and may cause a job to enter an unusable state.

警告:

This tool is intended for use with the Topographic Mapping production workflows and will not support an improperly configured Workflow Manager (Classic) repository. Sample workflows and instructions for configuring Topographic Mapping production workflows are available as part of the product file installer.

使用情况

  • If the name of a file in the target path matches a file from the source path, the file in the target will be overwritten.

  • This tool updates the TOPO_PRODUCTION_PROPERTIES.Current_Job_Path extended property value.

  • This tool requires that the TOPO_PRODUCTION_PROPERTIES.Shared_Job_Path and TOPO_PRODUCTION_PROPERTIES.Current_Job_Path extended property values are populated for the selected job.

  • When the Archive Source Files parameter is checked, a .zip file will be created containing the files from the source path. The .zip file will be created in the target path and named with the job ID and the current date time stamp.

  • When the Archive Source Files parameter is checked, the path to the .zip file created will be written to the TOPO_PRODUCTION_PROPERTIES.Output_File_Path extended property.

  • When the Delete Source Files parameter is checked, the source path and all the files it contains will be deleted after they are successfully copied to the target path.

  • When the Create Job Folder parameter is checked, a folder will be created in the target path. The folder will be named using the job name. All of the files from the source path will be copied to this new folder.

  • If values exist for the TOPO_PRODUCTION_PROPERTIES.Item_URL, TOPO_PRODUCTION_PROPERTIES.Current_Job_Data_Path, or TOPO_QC_PROPERTIES.job_reviewer_db extended properties, the values for the properties will be updated to point to the target path.

参数

标注说明数据类型
Job ID

The Job ID of the Workflow Manager (Classic) job that will be updated.

Long
Source Path

The path to the folder containing the files to be copied.

Folder
Target Path

The path to the location where the files will be copied.

Folder
Archive Source Files
(可选)

Specifies whether the files in the source path will be zipped before copying to the target location.

  • Checked—A .zip file with the contents of the source directory will be created and copied to the target location.
  • Unchecked—The contents of the source directory will be copied directly to the target location. This is the default.
Boolean
Delete Source Files
(可选)

Specifies whether the files in the source path will be deleted after the files are copied to the target location.

  • Checked—The source directory and all its contents will be deleted after the files are copied.
  • Unchecked—The source directory will not be deleted after the files are copied. This is the default.
Boolean
Create Job Folder
(可选)

Specifies whether a folder will be created in the target path for containing the copied files.

  • Checked—A folder will be created in the target path with the name of the chosen job. Files are copied from the source path to this new folder.
  • Unchecked—A folder will not be created, and files from the source path will be copied directly to the target path. This is the default.
Boolean
Input Database Path
(可选)

The Workflow Manager (Classic) database connection file (.jtc) that contains the job information. If no connection file is specified, the current default Workflow Manager (Classic) database will be used.

File

派生输出

标注说明数据类型
Updated Job ID

The Job ID of the updated Workflow Manager (Classic) job.

Long

arcpy.topographic.CopyJobFiles(job_id, source_path, target_path, {archive_source}, {delete_source}, {create_job_folder}, {database_path})
名称说明数据类型
job_id

The Job ID of the Workflow Manager (Classic) job that will be updated.

Long
source_path

The path to the folder containing the files to be copied.

Folder
target_path

The path to the location where the files will be copied.

Folder
archive_source
(可选)

Specifies whether the files in the source path will be zipped before copying to the target location.

  • ARCHIVEA .zip file with the contents of the source directory will be created and copied to the target location.
  • NO_ARCHIVEThe contents of the source directory will be copied directly to the target location. This is the default.
Boolean
delete_source
(可选)

Specifies whether the files in the source path will be deleted after the files are copied to the target location.

  • DELETE_SOURCEThe source directory and all its contents will be deleted after the files are copied.
  • NO_DELETE_SOURCEThe source directory will not be deleted after the files are copied. This is the default.
Boolean
create_job_folder
(可选)

Specifies whether a folder will be created in the target path for containing the copied files.

  • CREATE_JOB_FOLDERA folder will be created in the target path with the name of the chosen job. Files are copied from the source path to this new folder.
  • NO_CREATE_JOB_FOLDERA folder will not be created, and files from the source path will be copied directly to the target path. This is the default.
Boolean
database_path
(可选)

The Workflow Manager (Classic) database connection file (.jtc) that contains the job information. If no connection file is specified, the current default Workflow Manager (Classic) database will be used.

File

派生输出

名称说明数据类型
updated_job_id

The Job ID of the updated Workflow Manager (Classic) job.

Long

代码示例

CopyJobFiles example (stand-alone script)

This sample script copies files from a shared server machine to a local machine or copies files from a local machine back to a shared server machine.

# Name: CopyJobFiles_sample.py
# Description: Sample script for running the Copy Job Files tool to copy files from a shared server machine to a location
# on a local machine or to copy files from a local machine back to a shared server machine

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('JTX')

# Setting the environment
arcpy.env.overwriteOutput = True

# Setting Local Variables
job_id = 2031
source_path = r'\\server1\data\TopoMapping\TestData\ProJobArtifacts\TDS7_JOB_2029'
target_path = r'C:\data\Workflows'
archive_source = 'NO_ARCHIVE'
delete_source = 'NO_DELETE_SOURCE'
create_job_folder = 'CREATE_JOB_FOLDER'
database_path = r'C:\Data\Workflows\Testing.jtc'

# Calling the Copy Job Files tool to copy files from a shared server machine to a location on a local machine
arcpy.topographic.CopyJobFiles(job_id, source_path, target_path, archive_source, delete_source, create_job_folder, database_path)

# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))

# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('JTX')

环境

此工具不使用任何地理处理环境。

许可信息

  • Basic: 否
  • Standard: 需要 Production Mapping and Workflow Manager
  • Advanced: 需要 Production Mapping and Workflow Manager

相关主题