Skip to content

Getting timeouts?

Kim Nilsson edited this page Feb 26, 2023 · 7 revisions

When you have many devices, you will eventually run into timeouts.

The script simply can't run through all devices before it times out. It's simple, really. Every time you introduce a column, you also introduce another 32000 (or how many devices you have) cells of data.

Current version

Here's what I currently use to fill this CB_Activity-Link-GAM Sheets template. This time excluding deprovisioned devices.

It will upload fresh data to the DevicesGAM sheet, and then in the AdjustData sheet I manipulate that data to look like I want it, while minimising the amount of data that ends up the Devices sheet which will speed up the query from CB_LookUp.

I also limit the amount of columns printed to the Sheet in the first place. That required changing AdjustData sheet.

This command will only print these seven columns, and sort them all alphabetically: activeTimeRanges.date,activeTimeRanges.duration,lastSync,orgUnitPath,recentUsers.email,serialNumber,status

Here's the command. Don't forget to replace FileIDOfTheCB_ActivityGAMSheet with your own Sheet file id, and adjust the path to the logfile if you want it eselwhere.

time gam config csv_output_header_filter orgUnitPath,serialNumber,lastSync,status,activeTimeRanges.date,activeTimeRanges.duration,recentUsers.email csv_output_row_drop_filter "'^status$:regex:deprovisioned'" redirect csv - multiprocess todrive tdfileid FileIDOfTheCB_ActivityGAMSheet tdtitle "CB_Activity-Link-GAM" tdsheet DevicesGAM tdupdatesheet true redirect stdout ./logfile.log redirect stderr stdout print cros fields ou,serialNumber,lastSync,status,activeTimeRanges,recentusers listlimit 1 sortheaders

Then you just schedule that to run as often as you like. No script time limits and rarely any crashes.

Clone this wiki locally