Turn off geoprocessing history

603
3
11-21-2019 12:25 PM
annegrimes2
New Contributor II

Arcpy is writing all my geoprocessing history to the metadata of a file geodatabase I am trying to delete. 

The script to delete the file is on another server. 

However, the following code does not work:

arcpy.env.workspace = dataloc 
if arcpy.GetLogHistory():
   arcpy.SetLogHistory(False)

0 Kudos
3 Replies
JoeBorgione
MVP Esteemed Contributor

Are you trying to delete the history or just not create any new history as you run your scripts?  What version of ArcGIS/ArcPy are you using? 

There is a long,drawn out process described here that deletes existing geoprocessing history.  I've modified the code a bit and we run it the first of every month against all of our enterprise gdb's.  It also works with fgdb's.

FYI- none of the metadata related tools are available in the ArcGIS Pro environment (Yet).

In all of our scheduled task python scripts, right after we import arcpy, we use arcpy.SetLogHistory(False) so we aren't logging what we are doing.

That should just about do it....
0 Kudos
annegrimes2
New Contributor II

Hi Joe.

I don't want to create any new metadata content(GP History). 

I tried  arcpy.SetLogHistory(False) and it doesn't work.

My script (which resides on another server) is using python 3.6 (pro 2.4)

I just checked the metadata(see italics below) and I see a new record. It's a big problem because updates occur every 30 minutes.

Process
Date 2019-11-21 15:37:38
Tool location c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Data Management Tools.tbx\DeleteRows
Command issued
DeleteRows \\oi-agisxx-he-x.my.site\shared_drive\Map_Service_Data\Ops_me.gdb\Ops_me
Include in lineage when exporting metadata No

0 Kudos
RobertHolliday
New Contributor III

Greetings,

ESRI technical support logged BUG-000128506 regarding SetLogHistory function not functioning properly. I have this same issue. In my case and verified by tech support SetLogHistory is functioning as expected when the code is executed from within Pro from a python prompt. SetLogHistory is also functioning as expected if the code is tied to a toolbox tool.