manager() should use python lists for string arrays


There are a lot of string arrays in PBS, and trying to handle them in PTL is difficult when you need to worry about quoting strings with spaces, commas, etc.

The easiest way of solving this problem is to use a python list with the strings for the value of the string array.

Here's a current example of hook events, taken from the cgroups hook test:

events = '"execjob_begin,execjob_launch,execjob_attach,'
events += 'execjob_epilogue,execjob_end,exechost_startup,'
events += 'exechost_periodic,execjob_resize,execjob_abort"'
a = {'enabled': 'True',
'freq': '10',
'alarm': 30,
'event': events}


Here's what it would look like with the change:

events = ['execjob_begin', 'execjob_launch', 'execjob_attach',
       'execjob_epilogue', 'execjob_end', 'exechost_startup',
'exechost_periodic', 'execjob_resize', 'execjob_abort']
a = {'enabled': 'True',
'freq': '10',
'alarm': 30,
'event': events}

String array resources that are being set with only one string will still work, for example:

self.server.manager(MGR_CMD_SET, PBS_HOOK, {'events': 'execjob_begin'}, id='hook1')

Solution

If any of the strings in the list have quotes or special characters, it will separately set each one, so qmgr does not get confused as to what is a string boundary and what is actually in the string.

Otherwise, it will handle it in one qmgr call.