Summary
Copies Workflow Manager (Classic) job files to and from a local machine and a shared directory for processing.
Caution:
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.
Caution:
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.
Usage
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.
Syntax
CopyJobFiles(job_id, source_path, target_path, {archive_source}, {delete_source}, {create_job_folder}, {database_path})
Parameter | Explanation | Data Type |
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 (Optional) | Specifies whether the files in the source path will be zipped before copying to the target location.
| Boolean |
delete_source (Optional) | Specifies whether the files in the source path will be deleted after the files are copied to the target location.
| Boolean |
create_job_folder (Optional) | Specifies whether a folder will be created in the target path for containing the copied files.
| Boolean |
database_path (Optional) | 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 |
Derived Output
Name | Explanation | Data Type |
updated_job_id | The Job ID of the updated Workflow Manager (Classic) job. | Long |
Code sample
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')
Environments
Licensing information
- Basic: No
- Standard: Requires Production Mapping and Workflow Manager
- Advanced: Requires Production Mapping and Workflow Manager