Adding to accounting files

this isnt a resources_used.X type addition.

We have some things we would like to charge user’s for and I was hoping to
add in some non job related resource usages that our allocation scripts can track.
My thought was to add in a bogus end of job entry into the accounting logs once
a day to account for these charges.
Building a fake job entry is easy enough to do that our accounting/allocation tools
can read and understand. eg:

11/05/2018 11:00:27;E;0.pbs_server_name; user=random_user group=random_group jobname=resource_charge_2018_11_05 queue=daily_resource_charges etime=1541314800 ctime=1541314800 qtime=1541314800 start=1541314800 Resource_List.assigned_job=0.pbs_server_name Resource_List.nodect=1 Resource_List.walltime=24:00:00 session=4 Exit_status=0 resources_used.job_related_charges=38.99 resource_used.walltime=24:00:00

Just how I get the entry into the accounting file safely is the question.

The concept of running the script to generate the fake entries every so often
is fine but I suspect it will eventually try to write to the accounting file at the same time PBS is trying to. issues would ensue from there.

I thought about putting it into a server periodic hook but again I didnt see any
PBS way to add something to the accounting stream aside from just a normal
python open/write sort of thing.




It should be possible to implement something similar to pbs.logmsg(), but for accounting data. You wouldn’t want to write to the file directly because the server assumes it is the only writer.

You could also have your hook write records to a secondary accounting file that PBS knows nothing about and either join them together after the daily record is closed or parse them independently. Just a suggestion.



+1 @mkaro

  1. you can use execjob_epilogue hook to add entries into PBS Pro Accounting logs
  2. you can define a resource
    qmgr -c “create resource job_related_charges type=float”
  3. In the execjob_epilogue hook you can do the calculation and assign the charges to this custom resource which will be reflected in the accounting logs

j.resources_used["job_related_charges "] = float(total_cost_of_running_this_job)

Hope this helps

1 Like