Python scripts  do  not run complete on Sheduled task

5030
26
06-04-2013 04:09 AM
TAMARADIEZ
New Contributor III
Hi,

I have various python scripts running through scheduled tasks. Each scheduled task is pointing to a python script. They run independently.They are scheduled to run daily and have been working fine for months. Last week,  I added a new task and pointed to a new python script. It seem to be since then,  the tasks do not complete even I ran them manually. If I run the python scripts using python they work fine.


The tasks ran okay until the 29th May.  I compared the history of the tasks before the 29th May and after. I noticed in the Task Category the following difference:



1. When the task that ran properly (before 29th May), the instance is c:\python26\Arcgis10.0\python.exe
2. The same task  which does not complete after the 29th May. The instance is pointing to Notepad.exe

We use a Service account and it has the permmisions. Connections to ArcCatalog are in place.


Are you able to provide some advice please?

Thanks,

T
Tags (2)
0 Kudos
26 Replies
MichaelVolz
Esteemed Contributor
Are you running these scheduled tasks in a Windows OS environment?

If so, are you running on a workstation with an OS such as XP, 7, or 8?  Or are you running on a server with as OS such as Windows Server 2003 or 2008?
0 Kudos
TAMARADIEZ
New Contributor III
Hi,

It is Windows Server 2008 (64-bit). ArcGIS Server 10 and ArcGIS Desktop 10 is installed here too.

Thanks,

T
0 Kudos
MichaelVolz
Esteemed Contributor
Are you using Task Scheduler to set up these scheduled tasks?

If so, under Action what do you have set for Program/script?

Under Action what do you have set for Add arguments?

Under Action what do you have set for Start in?
0 Kudos
JacobBoyle
Occasional Contributor III
there's a great little piece of python code that'll let you call an ArcGIS Model without having to export it.

import arcpy

arcpy.ImportToolbox(r"Path to toolbox connection", "TBX")

arcpy.NAME OF MODEL_TBX()


couple things to note...

the path to the connection should be similar to :

C:\Users\USERNAME\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\YOURDATABASE\YOURTOOLBOX

or wherever your .sde files are located.  you can setup a .sde connection as an Administrator or as the SDE user, whichever model you use for security purposes.

Further...

The name of the model is not the name you give it in ArcCatalog, it's the internal name to the software.  This can be found in the Properties window for the model.  It'll be the in the first dialog box.  You can also change it to whatever you want.

arcpy.NAME OF MODEL_TBX()


Lastly, you save this as a .py file that you can then point to in Scheduled Tasks.  You'll need to run this script as an administrator on whatever machine you are running the file from.

Personally, I think it's easier to make changes to a model as opposed to exporting a model every time you want to change it.  In addition, you eliminate the need to cleanup the exported script, I have yet to have an exported python script from ModelBuilder work without some cleanup.
0 Kudos
TAMARADIEZ
New Contributor III
Hi,

Yes, I am using Scheduled Task. Please see attached image.

Thanks,

T
0 Kudos
MichaelVolz
Esteemed Contributor
Under Start In add C:\Python26\python.exe

then try running your scheduled task again
0 Kudos
RhettZufelt
MVP Frequent Contributor
Do you happen to be using the buffer tool in your script?

The reason I ask is that I have some python scripts that have been running just fine for a couple years now.  Starting 5/29, they all of a sudden started crashing on my buffer operation.
No errror, even have a try:/except: and it doesn't catch it.  if in IDE, it just "resets" and sits there quitely.

Not sure if related to Microsoft updates or what.  Still working on this one, just thought I'd ask since the timing is so similar.

R_
0 Kudos
TAMARADIEZ
New Contributor III
Under Start In add C:\Python26\python.exe

then try running your scheduled task again


Hi,

I entered "C:\Python26\ArcGIS10.0\python.exe" as Python that is location where python is. I've received the error below:

Task Scheduler failed to start instance "{dc05bb58-3898-46a6-a58f-0f9c077ae699}" of "\THH_Decent_Homes_External_Update"  task for user "Domian\Account_GisAdmin" . Additional Data: Error Value: 2147942667.



Thanks,

T
0 Kudos
TAMARADIEZ
New Contributor III
Do you happen to be using the buffer tool in your script?

The reason I ask is that I have some python scripts that have been running just fine for a couple years now.  Starting 5/29, they all of a sudden started crashing on my buffer operation.
No errror, even have a try:/except: and it doesn't catch it.  if in IDE, it just "resets" and sits there quitely.

Not sure if related to Microsoft updates or what.  Still working on this one, just thought I'd ask since the timing is so similar.

R_


Hi,

I do not have any buffers set up. They are 7 scheduled tasks each one pointing to a different python script. So each script is different.

Thanks,

T
0 Kudos