[slurm-users] how to print all the key-values of "job_desc" in job_submit.lua?

Bas van der Vlies bas.vandervlies at surf.nl
Mon Mar 29 15:01:02 UTC 2021



On 29/03/2021 13:03, Diego Zuccato wrote:
> Il 29/03/21 09:35, taleintervenor at sjtu.edu.cn ha scritto:
> 
>> Why the loop code cannot get the content in job_desc? And what is the
>> correct way to print all its content without manually specify each key?
> I already reported it quite some time ago. Seems pairs() is not working.
> 

Thanks for message. I was just testing it. Yes the did not implement the 
`__pairs` method for job_desc in job_submit_lua.c

```

static void _push_job_desc(job_desc_msg_t *job_desc)
{
     lua_newtable(L);

     lua_newtable(L);
     lua_pushcfunction(L, _get_job_req_field_index);
     lua_setfield(L, -2, "__index");
     lua_pushcfunction(L, _set_job_req_field); 
 

     lua_setfield(L, -2, "__newindex");
     /* Store the job descriptor in the metatable, so the index
      * function knows which struct it's getting data for.
      */
     lua_pushlightuserdata(L, job_desc);
     lua_setfield(L, -2, "_job_desc");
     lua_setmetatable(L, -2);
}

```


-- 
Bas van der Vlies
| HPCV Supercomputing | Internal Services  | SURF | 
https://userinfo.surfsara.nl |
| Science Park 140 | 1098 XG Amsterdam | Phone: +31208001300 |
|  bas.vandervlies at surf.nl



More information about the slurm-users mailing list