<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multiprocessing won't create feature classes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160774#M64271</link>
    <description>&lt;P&gt;I would speculate the source of your problem is what you are trying to pass into your worker function, as&amp;nbsp;@Anonymous User&amp;nbsp;says geometry is not pickleable. Just pass in the OID and then do the getting hold of a geometry and its extent within the worker function.&amp;nbsp; I worked up a template for people and wrote a short blog &lt;A href="https://community.esri.com/t5/python-documents/create-a-script-tool-that-uses-multiprocessing/ta-p/913862" target="_self"&gt;here.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2022 14:52:44 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2022-04-04T14:52:44Z</dc:date>
    <item>
      <title>Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160423#M64247</link>
      <description>&lt;P&gt;I'm trying to implement a fairly straightforward multiprocessing script that takes every polygon in a shapefile, tessellates into a grid, takes the center points of each grid square, and then clips the points by the original feature (since the tessellation generates a minimum bounding rectangle).&amp;nbsp; The tessellation feature class is never created so next step (FeatureToPoint) fails.&amp;nbsp; I don't understand - can someone help?&lt;/P&gt;&lt;P&gt;Even if I comment out all the arcpy commands except GenerateTessellation, the output is never actually created.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import multiprocessing
import os
import time
import arcpy

startTime = time.time()

basedir = r"C:\Users\Jay\Documents\ArcGIS\Projects\DataPrep"
scratchGDB = 'C:\\Jay\\data\data.gdb'
output = os.path.join(basedir, "grids.gdb")
features = os.path.join(basedir,"features.shp")

def multifunction(ft):
    import arcpy
    name = ft[0]
    extent = ft[1].extent
    print('Working on {}'.format(name))
    fl = arcpy.management.MakeFeatureLayer(features, "{}fl".format(name), where_clause=f"Name='{name}'")
    gdb = os.path.join(basedir, "{}.gdb".format(name))
    arcpy.management.CreateFileGDB(basedir, "{}.gdb".format(name))
    output=os.path.join(gdb, "{}grid".format(name))
    grid = arcpy.management.GenerateTessellation(output, Extent=extent, Shape_Type="SQUARE", Size="900 SquareMeters")
    print('tellessation')
    pointgrid = arcpy.management.FeatureToPoint(grid, os.path.join(scratchGDB, "{}pointgrid".format(apt)))
    arcpy.analysis.Clip(pointgrid, fl, os.path.join(output, f"{apt}Points"))
    arcpy.management.Delete(fl)
    arcpy.management.Delete(grid)
    arcpy.management.Delete(pointgrid)

def main():
    processList = [feature for feature in arcpy.da.SearchCursor(features, ['Name', 'SHAPE@'])]
    pool = multiprocessing.Pool(1)
    pool.map(multifunction, processList[0:10])
    pool.close()
    pool.join()

if __name__ == "__main__":
    print("Running")
    main()
    executionTime = (time.time() - startTime)
    print('Execution time in seconds: ' + str(executionTime))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160423#M64247</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-01T20:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160430#M64248</link>
      <description>&lt;P&gt;Hello Jay,&lt;/P&gt;&lt;P&gt;Try putting double back slashes in your basedir and raise 'r' at the beginning of your scratchGDB... make sure it follows format with double back slashes and double quotes around path.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:26:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160430#M64248</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2022-04-01T20:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160436#M64249</link>
      <description>&lt;P&gt;Thanks for the tip - just did that, but it still didn't fix the issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:34:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160436#M64249</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-01T20:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160439#M64250</link>
      <description>&lt;P&gt;for output and features variables use the full paths for basdir&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 20:41:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160439#M64250</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2022-04-01T20:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160452#M64251</link>
      <description>&lt;P&gt;Even if I make those lines the below it still doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;output = "C:\\Users\\Jay\\{}.shp".format(name)
print(output)
grid = arcpy.management.GenerateTessellation(output, Extent=extent, Shape_Type="SQUARE", Size="900 SquareMeters", Spatial_Reference=arcpy.SpatialReference(4326))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 21:05:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160452#M64251</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-01T21:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160477#M64252</link>
      <description>&lt;P&gt;Check your extent and area parameters first with a print statement&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/extent.htm" target="_blank" rel="noopener"&gt;Extent—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/generatetesellation.htm" target="_blank" rel="noopener"&gt;Generate Tessellation (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And you didn't indicate whether the process works with just one, skipping the multiprocessing stuff&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 22:02:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160477#M64252</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-01T22:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160572#M64259</link>
      <description>&lt;P&gt;Correct me if I am wrong, but I don't think that File Geodatabases support concurrent writing. I, at least have never been able to do so with multiprocessing and from experience in trying to, the worker fails at that point. Writing to directory works concurrently. It should at least write the first one to the gdb, and maybe another if the lock is released in time for another worker to write. Another thing that I see that may be an issue is if the feature (specifically the geometry) you are passing is able to be pickled. Wrapping the code in a try/except can provide some clues.&lt;/P&gt;&lt;P&gt;Running it once may provide false positives due to the file geodatabase limitation so I would use some breakpoints and debug it. I would move the worker to a new file and wrap the process in a try/except to return either success or the exception to the pool results list. Then you can print out the results and see what is failing in your processes.&lt;/P&gt;&lt;P&gt;When you map to the function that is located in the same script, it loads the whole script again so keeping your worker in a separate file will just load the function and not go through the global scope code and if name is main name check stuff again.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 03:00:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160572#M64259</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-03T03:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160597#M64261</link>
      <description>&lt;P&gt;This is an example of some processes that I have set to work in multiprocessing.&amp;nbsp; The script checks to see if the datasets needs to be exported (source date &amp;gt; destination date) that returns a dictionary of basic messages.&amp;nbsp; In a separate script is the worker:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# IMPORTS
from arcpy import CopyFeatures_management
from arcpy import env

def export_to_shp(fcname, fc, shp):
    """
    Function to copy features to shapefile
    """
    try:
        env.overwriteOutput = True
        CopyFeatures_management(fc, shp)
        return {'fcname': f'{fcname}', 'status': True, 'exmessage': 'was exported!'}

    except Exception as ex:
        return {'fcname': f'{fcname}', 'status': False, 'exmessage': f'{ex}'}&lt;/LI-CODE&gt;&lt;P&gt;The main script looks like this. I removed a lot of the variables that are in house to us, so this wont be a copy/run but just to get an idea of structure and how you can return useful information from the multiprocessing.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# IMPORTS
import datetime as dt
import os
import sys
import time as t
from multiprocessing import Pool
import arcpy
from multiprocesses import ExportToShp

# ---------------------------------------------------------------------------

def weekly_export(sde_view):
    """
    Function to export featureclasses to shapefiles if they were changed in the past 7 days
    :param sde_view: connection class to connect to sde and output directories
    """
    arcpy.env.overwriteOutput = True
    startTime = t.time()
    try:
        # Featureclasses variables:
        themesDir = r'path to output folder'

        fcDict = {
            'zoning': [sde_view.fc_connection("admin_CLC", "zoning"),
                       os.path.join(themesDir, 'zoning.shp')],
            'row': [sde_view.fc_connection("property", "row"),
                            os.path.join(themesDir, 'row.shp')],
            'physftr': [sde_view.fc_connection("property", "physftr"),
                            os.path.join(themesDir, 'physftr.shp')],
            'streets': [sde_view.fc_connection("transportation", "streets"),
                        os.path.join(themesDir, 'streets.shp')]
        }

        fcList = []
        for fc, fcPaths in fcDict.items():
            # mt is an in house maintenance package, its just checking dates and feature counts here.
            if any([mt.last_edited_date_check(fcPaths[0], "last_edited_date", 7),
                    mt.get_number_of_features(fcPaths[1]) &amp;gt; mt.get_number_of_features(fcPaths[0])]):
                fcList.append((fc, fcPaths[0], fcPaths[1]))

        # If more than one dataset needs to be exported, do it in parallel
        if len(fcList) &amp;gt; 1:
            with Pool(processes=4) as pool:
                result = pool.starmap(ExportToShp.export_to_shp, fcList)

            for res in result:
                print(f'{res["fcname"]} {res["exmessage"]}')
                if not res['status']:
                    print(f'{res["fcname"]} {res["exmessage"]}')

        elif len(fcList) == 1:
            result = ExportToShp.export_to_shp(fcList[0][0], fcList[0][1], fcList[0][2])
            print(f'{result["fcname"]} {result["exmessage"]}')
            if not result['status']:
                print(f'{result["fcname"]} {result["exmessage"]}')

        else:
            print('No updates were made and nothing was exported')


    except Exception as err:
        print(
            f'{sys._getframe().f_code.co_name} - FAILED in {dt.timedelta(seconds=t.time() - startTime)}! See error log...')
        print(f'{sys._getframe().f_code.co_name} FAIL! - {err}')


if __name__ == '__main__':
    mTime = t.time()
    try:
        weekly_export(con)

        print(f'Export Weekly - COMPLETED in {dt.timedelta(seconds=t.time() - mTime)} ...')

    except Exception as err:
        print(
            f'{sys._getframe().f_code.co_name} - FAILED in {dt.timedelta(seconds=t.time() - mTime)}! See error log...')
        print(f'{sys._getframe().f_code.co_name} FAIL! - {err}')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 12:24:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160597#M64261</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-03T12:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160724#M64267</link>
      <description>&lt;P&gt;I have simplified everything to minimize the number of lines of code, split out my multiprocessing function into a separate file, tested without using multiprocessing, trying to catch errors, and still can't get it to work.&amp;nbsp; Could this have something to do with the GenerateTessellation method?&lt;/P&gt;&lt;P&gt;First my file containing the function to be passed into the multiprocessing Pool:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def multifunction(airport):
    from arcpy import GenerateTessellation_management
    import os
    apt = airport[0]
    extent = airport[1].extent
    print('Working on {}'.format(apt))
    outputDir = "C:\\Jay\\data\\{}".format(apt)
    os.mkdir(outputDir)
    output = "C:\\Jay\\data\\{}\\{}.shp".format(apt, apt)
    print(output)
    try:
        GenerateTessellation_management(output, Extent=extent, Shape_Type="SQUARE", Size="900 SquareMeters")
    except Exception as err:
        print("error", err)
    return output&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Next the main file:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import multiprocessing
import os
import time
import arcpy
from func import multifunction

startTime = time.time()

basedir = "C:\\Users\\jay\\Documents\\ArcGIS\\Projects\\DataPrep"
features = os.path.join(basedir,"features.shp")


def main():
    processList = [ft for ft in arcpy.da.SearchCursor(features, ['Name', 'SHAPE@'])]
    #THESE LINES DO WHAT I WANT
    # for row in processList[0:10]:
    #      multifunction(row)

    pool = multiprocessing.Pool()
    pool.map(multifunction, processList[0:10])
    pool.close()
    pool.join()


if __name__ == "__main__":
    print("Running")
    main()
    executionTime = (time.time() - startTime)
    print('Execution time in seconds: ' + str(executionTime))&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 Apr 2022 13:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160724#M64267</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-04T13:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160743#M64268</link>
      <description>&lt;P&gt;If I comment out the GenerateTessellation line and replace it with&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CreateFeatureclass_management&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;outputDir&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;SPAN&gt;.shp"&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;apt&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;geometry_type&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"POINT"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;spatial_reference&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;SpatialReference&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;4326&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;the multiprocessing works.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'm getting no pickling errors, but this might have to do with the Extent portion?&amp;nbsp; I have no idea &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Apr 2022 13:54:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160743#M64268</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-04T13:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160745#M64269</link>
      <description>&lt;P&gt;Python's multiprocessing is frustrating. What does&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;processList[0:10]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;processList[0:10] look like?&amp;nbsp;&lt;/P&gt;&lt;P&gt;The the arguments that you are passing may be unpacked as individual arguments so you may need to pass your tuple as (processList[0:10], ) or create each pair into the (args, ) format when you create the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;itemPairs = [([ft[0], ft[1]],) for ft in da.searchCursor()]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hard to say without seeing the data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the data that you want to pass to the worker has to be a built in data type/ structure. Geometry is an arcpy data type/ object, so you need to create a pickle-able class for it to convert it to bytes to be able to pass into the multiprocessing stuff.&lt;/P&gt;&lt;P&gt;Additionally, you should adjust the return output to return the exception as well.&amp;nbsp; Your not doing anything with the return result so its hard to know what the issue is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# global level variable
res = []

try:
     GenerateTessellation_management(output, Extent=extent, Shape_Type="SQUARE", Size="900 SquareMeters")
    res.append({'result': 'success', 'msg': 'It worked'})

except Exception as err:
    print("error", err)
    res.append({'result': 'error', 'msg': err})
return res&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then go over the results like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;with Pool(processes=4) as pool:
     result = pool.starmap(multifunction, processList[0:10])

for res in result:
   print(f'{res["result"]} {res["msg"]}')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160745#M64269</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-04T14:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160754#M64270</link>
      <description>&lt;P&gt;Looks like we overlapped posts. If that is case, I'd work on returning the error message from the worker using the example code in my last post and going from there.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160754#M64270</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-04T14:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160774#M64271</link>
      <description>&lt;P&gt;I would speculate the source of your problem is what you are trying to pass into your worker function, as&amp;nbsp;@Anonymous User&amp;nbsp;says geometry is not pickleable. Just pass in the OID and then do the getting hold of a geometry and its extent within the worker function.&amp;nbsp; I worked up a template for people and wrote a short blog &lt;A href="https://community.esri.com/t5/python-documents/create-a-script-tool-that-uses-multiprocessing/ta-p/913862" target="_self"&gt;here.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:52:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1160774#M64271</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2022-04-04T14:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1161815#M64291</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3515"&gt;@DuncanHornby&lt;/a&gt;&amp;nbsp;@Anonymous User&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;I changed my setup so the extent is passed in as a "&lt;SPAN&gt;Space delimited string of coordinates" per the Generate Tessellation documentation (&lt;A href="https://pro.arcgis.com/en/pro-app/2.8/tool-reference/data-management/generatetesellation.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/2.8/tool-reference/data-management/generatetesellation.htm&lt;/A&gt;).&amp;nbsp; So at this point I'm just passing in an array with two strings to my multiprocessing pool function and no errors are thrown but the output is not created.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I replace the generate tellessation line wtih CreateFeatureclass, output is generated.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I even tried hard coding the extent, hard coding the spatial reference as a string instead of an arcpy method, and nothing works.&amp;nbsp; I have been getting other multiprocessing code to work too, so I think there is something in the GenerateTessellation method that is causing this (but no errors are thrown).&amp;nbsp; At this point I have gone over every possible thing I could think of except reinstall Pro.&lt;/P&gt;&lt;P&gt;If someone wants to validate they can create a function with just one line.&amp;nbsp; Set your output to be some shapefile, and then run it&amp;nbsp;&lt;EM&gt;once&lt;/EM&gt; as a multiprocessing function.&amp;nbsp; Does it create the grid?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.GenerateTessellation(output, "-86.809667396 33.5218054870001 -86.7009855469999 33.6051117490001", "SQUARE", "900 SquareMeters", 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision')&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Apr 2022 20:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1161815#M64291</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-06T20:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1161938#M64295</link>
      <description>&lt;P&gt;It created in my environment. I'm running Pro 2.9.2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 03:00:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1161938#M64295</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-07T03:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162015#M64297</link>
      <description>&lt;P&gt;Hello Jeff,&lt;/P&gt;&lt;P&gt;I didn't see that this was solved yet, so I thought I would give this a try and offer up another idea?&lt;/P&gt;&lt;P&gt;Have you tried building this multiprocessing workflow into a model in ModelBuilder?&amp;nbsp; There are tools in ModelBuilder that may be able to iterate your processes without all the tedious code.&amp;nbsp; Once you get it working you can export the script for automation.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 12:21:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162015#M64297</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2022-04-07T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162030#M64298</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;Would you mind posting your code.&amp;nbsp; I just upgraded to 2.9.2 and still nothing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mine is as simple as I could make it - still no errors and no output either.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import multiprocessing
from processRun import multifunction

def main():
    pool = multiprocessing.Pool(processes=4)
    pool.map(multifunction, range(0,1))
    pool.close()
    pool.join()

if __name__ == "__main__":
    main()&lt;/LI-CODE&gt;&lt;P&gt;My processRun file looks like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
def multifunction(num):
    arcpy.management.GenerateTessellation("C:\\Users\\jay\\Documents\\test.shp", "-86.809667396 33.5218054870001 -86.7009855469999 33.6051117490001", "SQUARE", "900 SquareMeters", 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision')&lt;/LI-CODE&gt;&lt;P&gt;If yours is working, and I can't get it to work on my machine I'll probably just give up.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 12:49:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162030#M64298</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-07T12:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162031#M64299</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/486546"&gt;@ABishop&lt;/a&gt;&amp;nbsp; I'm comfortable doing this in ModelBuilder if I needed to.&amp;nbsp; My issue is I have a process I would like to automate that takes over an hour, and would like to improve the performance using the multiprocessing module in Python like I have with some other projects.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 12:50:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162031#M64299</guid>
      <dc:creator>Jay_Gregory</dc:creator>
      <dc:date>2022-04-07T12:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162038#M64300</link>
      <description>&lt;P&gt;It's no problem.&amp;nbsp; I just thought I would put it out there!&amp;nbsp; Sometimes when I am having trouble with my scripts, it helps me to see it from another viewpoint or platform.&amp;nbsp; Good luck!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:00:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162038#M64300</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2022-04-07T13:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Multiprocessing won't create feature classes</title>
      <link>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162209#M64305</link>
      <description>&lt;P&gt;Shoot, yes, I thought you wanted to test just the line so that's what I did and it generated the square. Throwing it into the mp mix, it fails with the false positive:&lt;/P&gt;&lt;P&gt;Succeeded at Thursday, April 7, 2022 10:51:14 AM (Elapsed Time: 0.03 seconds)&lt;/P&gt;&lt;P&gt;I would open a case with ESRI if you could.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:57:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multiprocessing-won-t-create-feature-classes/m-p/1162209#M64305</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-04-07T16:57:03Z</dc:date>
    </item>
  </channel>
</rss>

