gam print courses "order of operations"

221 views
Skip to first unread message

Shaun Creighton

unread,
Jul 16, 2021, 11:16:02 AM7/16/21
to GAM for Google Workspace
We're doing our annual cleanup/creation of Google Classrooms, and I recently ran the following:

gam print courses todrive fields id,name,section,description,coursestate,creationtime,updatetime timefilter creationtime start 2021-07-15

This "got" 40,759 courses, which represents all of the Google Classrooms in our domain ... but when I opened the Google Sheet, there were 9,057 listed that matched my creationtime criteria, which is what I expected. So far so good.

The "problem" comes when I add the alias parameter:

gam print courses todrive alias fields id,name,section,description,coursestate,creationtime,updatetime timefilter creationtime start 2021-07-15

After getting the 40,759 courses, the output appears as such:

Got 1 Alias for Course: COURSEID1 (1/40759)...
Got 1 Alias for Course: COURSEID2 (2/40759)...

So it appears that GAM is attempting to retrieve the alias for all 40,759 courses (which requires a separate API call per course). It seems like it would be much more efficient to only grab the alias for the courses that match the creationtime filter (GAM seems to behave this way when filtering by course state), especially because the last time I ran the command, I got the following at the end:

Got 0 Aliases for Course: COURSEID9034 (9034/40759)...
Got 0 Aliases for Course: COURSEID9035 (9035/40759)...
Data uploaded to Drive File:
API calls retry data
  The service is currently unavailable.: 1/0:00:02

The link did point to a spreadsheet that only listed 9,035 Classrooms and all of them included the alias and met the creationtime filter. Normally I would think that the "service currently unavailable" error hosed the command, but the fact that it did give me a spreadsheet was interesting.

Is GAM actually filtering by creationtime before it retrieves the aliases with the (NNN/NNNNN) count information just being inaccurate? Or is it actually attempting to retrieve aliases for all Classrooms, then applying the creationtime filter (and possibly timing out)?

Thanks,

Shaun

Ross Scroggs

unread,
Jul 16, 2021, 1:40:53 PM7/16/21
to google-ap...@googlegroups.com
Shaun,

GAM gets all of the courses.
It steps through the list applying local filters, creation time for instance.
Only if the course passes the filter does it call the API to get the alias.
Since Gam doesn't know how many courses are going to pass the filter,
Got 1 Alias for Course: COURSEID1 (1/40759)...
reflects the number of courses that have currently passed the filter out of the total number of courses.

This data reflects that one API call returned "The service is currently unavailable.", GAM waited 2 seconds and then everything proceeded
without further incident.

API calls retry data
  The service is currently unavailable.: 1/0:00:02

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/68e5971b-938d-4981-8b83-f4af5511009dn%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages