我正在尝试使用多重处理以位为单位处理数据,并且具有以下有效的代码:
if __name__ == '__main__':
for q in query_list:
out_name = "Contour_Other" + str(q[0]) + ".gdb"
arcpy.CreateFileGDB_management(out_folder_path,out_name)
dest_gdb = out_folder_path + "/" + out_name
generated_filegdb_list.append(dest_gdb)
query = "objectid > " + str(q[0]) + " AND objectid <= " + str(q[1])
output_path = dest_gdb + "/" + large_featureclass[14:] + str(q[0])
generated_features_list.append(output_path)
p = multiprocessing.Process(target=arcpy_select_analysis, args = (large_featureclass, output_path, query ))
p.start()
processor_list.append(p)
它的作用是获取一个query_list,它是列表[[0,10],[11,20],[21,30]]的列表,依此类推,创建了一堆地理数据库文件并使用select语句将各个列表输出到创建的单独的地理数据库中。
当我尝试更改代码以适应另一个迭代时发生了问题,因此我将代码更改为:
if __name__ == '__main__':
for features in feature_list:
for q in query_list:
out_name = "Contour_Other" + str(q[0]) + ".gdb"
arcpy.CreateFileGDB_management(out_folder_path,out_name)
dest_gdb = out_folder_path + "/" + out_name
generated_filegdb_list.append(dest_gdb)
query = "objectid > " + str(q[0]) + " AND objectid <= " + str(q[1])
output_path = dest_gdb + "/" + large_featureclass[14:] + str(q[0])
generated_features_list.append(output_path)
p = multiprocessing.Process(target=arcpy_select_analysis, args = (large_featureclass, output_path, query ))
p.start()
processor_list.append(p)
feature_list是包含三个独立功能(例如[Contours,Contours_10,Contours_2])等的列表。我期望发生的是重复成功完成代码,但仅针对这三个不同功能。
相反,我看到新代码设法达到了generate_features_list.append(output_path)部分,但是无法使用multiprocessing.Process部分传输任何数据