Python Hook Print to Standard Out?

Want to send a friendly message to the requestor when they submit something and I think I know better and make a mod to the job

Seems like one of the only ways to send feedback to the end user cli is pbs_event.reject but I want the job to run. Seem harsh.

print("hi") and print("hi", file=sys.stderr)

Doesn’t do it. Of course I can log it too discrete. Was wondering about letting the end user know about a modification I make make on queue submit.

I have been through the hooks docs and I don’t see it (actually, that reminds me to see if there is any sphinx style docs for their hooks)

This is an often requested feature, but it doesn’t exist (to my knowledge). Many ugly hacks have been suggested.

One ugly suggestion is to check the job specification for the “site” resource. If site includes the string “no_nags”, you let the job pass. Otherwise, you reject it with an explanation. The user can either change the job to match your preferred way, or add -l site=“no_nags” to the qsub.

Another suggestion is to have the hook put something in the pbs logs. Then have a script that runs once a day that checks for these messages and sends email to the user. The smart version of the script sends only one email per day per user.

Oh yeah, so it is leveraging .reject()… think I like that better for immediacy. But still too harsh a reaction. lol.

a shame, not sure where print to std out and error went (?) but too harsh, more a gentle FYI… e.g. we use bright cluster and the deeper you get into the config the hazier it gets. So… rather than use config2 to set the default placement packing, one of the clauses to set something like “free” and let them know. (like why that cann’t be set in queue manager is a curiosity).

Something like… (and the code can be off… just… you know. off memory

# code to get the job object.... then
pbs_place_str = str(pbs_job.resource_list["place"])
...
...
        if not any(placement in pbs_place for placement in ["scatter","pack","free", "whatever"]):
            pbs_job.resource_list["place"] = pbs.place("free:" + pbs_place_str)
            # this next pbs function does not exist future readers, for example
            pbs.usermsg(f"job placement updated to free:{pbs_place_str} cause we wanted to")

btw, “place” is a null object if old resource syntax is used.