A very ugly workaround for having cpus_alloc column would be: create view custom_job_table as select *,substring_index(substring_index(tres_alloc,',',1),'1=',-1) as cpus_alloc from <cluster_name>_job_table;
*--Felip Moll Marquès* Computer Science Engineer E-Mail - [email protected] WebPage - http://lipix.ciutadella.es 2016-05-20 11:13 GMT+02:00 Felip Moll <[email protected]>: > Hello, > > I've noted that the column "cpus_alloc" from the <clustername>_job_table > have disappeared from 14.x to 15.08.x. Instead of storing allocated CPUs in > this column now we have it in tres_alloc column. > > tres_alloc is a text field in <clustername>_job_table that stores the > allocated trackable resources in the from <id=value>. Multiple resources > are stored separated by commas. This is not practical for use with custom > applications. > > mysql> select id_job,tres_alloc from cnag_job_table limit 5; > +--------+-------------------+ > | id_job | tres_alloc | > +--------+-------------------+ > | 2 | 1=2,2=2048,4=1 | > | 3 | 1=2,2=2048,4=1 | > | 4 | 1=2,2=2048,4=1 | > | 5 | 1=20,2=20480,4=10 | > | 6 | 1=2,2=2048,4=1 | > +--------+-------------------+ > 5 rows in set (0.00 sec) > > The ID of the trackable resource is stored in tres_table: > > mysql> select * from tres_table; > +---------------+---------+----+--------+------+ > | creation_time | deleted | id | type | name | > +---------------+---------+----+--------+------+ > | 1455810070 | 0 | 1 | cpu | | > | 1455810070 | 0 | 2 | mem | | > | 1455810070 | 0 | 3 | energy | | > | 1455810070 | 0 | 4 | node | | > | 1457522870 | 0 | 5 | gres | gpu | > +---------------+---------+----+--------+------+ > 5 rows in set (0.00 sec) > > > Question: > > Why not create a third table, tres_values:[ idx | tres_id | value | job_id > ], then delete tres_alloc column of <clustername>_job_table, and then fill > the values of TRES into this new table? > > Benefits of this could be for example that easy queries could be performed > to search individually any tres consumed resource for a job, i.e.: > > select value from tres_values where job_id=1 and tres_id=0; <--- This > would give me CPU consumed for job_id = 1. > > To do this, actually values of tres_alloc column must be parse externaly > to mysql. > > > Regards, > Felip M > > > *--Felip Moll Marquès* > Computer Science Engineer > E-Mail - [email protected] > WebPage - http://lipix.ciutadella.es >
