After publishing routing services from a network dataset configured with live traffic, it is essential to ensure that the live traffic data used by these services is updated at regular intervals. This can be achieved by following the workflow outlined below:
You need to configure a Python script to run every two minutes using Windows Task Scheduler. This built-in Windows utility allows users to automate the implementation of tasks and programs at specified times. While you can use the user interface of Windows Task Scheduler to create a task for updating live traffic data, this section describes the same workflow using a command-line utility called schtasks.
Update live traffic data every two minutes by running a Python script using Windows Task Scheduler. The example assumes that the ArcGIS Server installation location is C:\Program Files\ArcGIS\Server.
schtasks /create /tn "ArcGISLiveTrafficDataUpdater" /tr "\"C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\envs\arcgispro-py3\python.exe\" \"C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcToolBox\Services\routingservices\update_traffic_cache_scheduler.py\"" /sc minute /mo 2 /ru "SYSTEM"
Note:
The above steps must be performed on every machine in a multimachine ArcGIS Server site.
The Python script generates a log file named update_traffic_cache_scheduler.log, which is stored in the default folder where ArcGIS Server writes its logs such as c:\arcgisserver\logs. You can check this log file to determine whether any errors occurred during the implementation of the script.
Check live traffic data status
After you have set up the live traffic data to update at regular intervals, you can verify whether the traffic data is updating successfully by running the GetLiveTrafficStatus tool within the NetworkAnalysisUtilities geoprocessing service. This service is available in the same folder where other routing services were published. For example, if the routing services were published to a service folder named Routing, the URL to the GetLiveTrafficStatus tool will be https://machine.example.com/webadaptorname/rest/services/Routing/NetworkAnalysisUtilities/GPServer/GetLiveTrafficStatus. The output from GetLiveTrafficStatus can be used to check whether the traffic data is successfully updating.
Example output from the GetLiveTrafficStatus tool shows that the last update was successful since isLastUpdateSuccessful is true. If there are errors during the last update, isLastUpdateSuccessful is set to false, and the reasons for failure are returned as part of the lastUpdatedMessages property.
{
"results": [
{
"paramName": "status",
"dataType": "GPString",
"value": {
"cachePath": "C:\\NA\\RoutingServices\\traffic-cache\\openlr.3a795f46cf77473fb1dc606ef73a2cb5",
"isLastUpdateSuccessful": true,
"isUpdateInProgress": false,
"roadClosuresDataAvailable": true,
"roadClosuresDataSize": 64427318,
"speedDataAvailable": true,
"speedsDataSize": 3977019303,
"tempDataSize": 365970076,
"trafficCacheStatus": {
"endTimeWindow": 1744065360000,
"lastCreatedFileNames": [
"speeds.20250407132800.1.ff.dat",
"speeds.20250407213200.1.nff.dat",
"road_closures.20250407213200.1.dat",
"speeds.20250407213200.info.dat",
"speeds.20250407213600.info.dat"
],
"lastDecodingElapsedTime": 0,
"lastRemovedFileNames": [
"speeds.20250407173200.info.dat",
"road_closures.20250407173200.1.dat"
],
"lastUpdatedElapsedTime": 11582,
"lastUpdatedMessages": [
],
"lastUpdatedTime": 1744062137882,
"remainingSpeedLocationsToMatch": 0,
"roadClosureLocationsCount": 23153,
"selectedTrafficDataRegions": [
"CAN",
"MEX",
"USA_N",
"USA_SW",
"USA_SE",
"USA_M"
],
"speedLocationsCount": 1468719,
"startTimeWindow": 1744047330000
}
}
}
],
"messages": [
]
}