Server side hook at the end of job

Hi

There is an option to run some hook after job has been finished on server side and not mom side?

Thanks
Chagai

Please let us know the usecase of running something on the server side.

We would like to decrease the usage of fairshre with hooks

it possible to play with fairshare usage with hooks?

You can use these two parameters in the sched_config
fairshare_decay_time: 24:00:00
fairshare_decay_factor: 0.5

Please check the admin guide on the above two parameters.

This can be achieved without any hook events, the fairshare decay is done automatically by the scheduler with the use of above parameters.

yes I play with the decay and it not give me what I need.
I want that at the end of every job to reduce the usage.
lets say that the fairshare_usage_res is on ncpu, and every job require 1 ncpu.
so on the end if the job the usage will reduce by one.

Please note, the usage tracking begins when the scheduler is started and the scheduler adds the usage increment between the current cycle and the previous cycle to its sum for the entity. Please share your sched_config , if you set fairshare_usage_res: ncpus*walltime and by running test jobs asking for 4ncpus/ walltime 5 mins , 3ncpus/4 mins, 2ncpus/3mins ,1ncpus/2 mins and have pbsfs command on a temporary watch, then you might see the usage.

I want to add the functionality like ‘scheduler adds the usage’ during the job that I will be able to decrease the usage after job has been finished.
hooks was just example if its something that need code change I can try to do it but i would like to know if you think its something that possible to do ?

Many thx

Hey,
There is a new hook that does what you want with caveats. In 22 we have a job obit hook. This means any time the mom sends a obit for a job, the server hook gets run. 99% of the time, this will be at the end of the job. Job obits are sent anytime the job leaves execution. The job doesn’t always have to leave the system. For example, on a qrerun, an obit will be sent, but the job will be requeued.

You could use this new hook event to do what you want. You can modify the fairshare usage with the pbsfs command. The scheduler will take notice of the new usage in its next cycle.

The scheduler will continue to decay the usage. This means it might decay the usage for a job in the middle of it. If you decrease the usage at the end, you might decrease it by too much. If you do go this route, I’d lower the decay factor or increase the decay time.

On another note, you might want to add a time factor to your usage (e.g. ncpus*walltime). If you set it to just ncpus, the usage will only go up by the ncpus value. This means no matter how long the job is, only that usage will be added. Depending on what you do with the decay, you might decay the number of cpus several times during the run time of a long running job. For example, if you have a 12 cpu job, you’d increase the usage by 12. Part of the way through the job you decay to 6. Now you’re running the same job, but you have less usage. If it decays another time, now you’re at 3. You are still running the same 12 cpu job, but only are accounting for 3 usage.

In any case, if still have your heart set on using a hook, checkout the new jobobit hook event.

Bhroam

hI Bhroam,

A. Big thx for your detailed answer I appreciate it very much, thx!
B. how can I download 22 version? I cant see it under releases (Releases · openpbs/openpbs · GitHub).
C. There is an option to decrease the usage by the taken resources of the job?
let assume 1 cpu per job can I decrease it exactly by1 cpu? (I tried to play with pbsfs but I don’t think I can decrease like that)
D. do you think it will have performance issues on the server?