High Performance Computing Group

 View Only
Expand all | Collapse all

Anyone using bsubmit and if so any idea where in the esub environment you can find the username that was passed to run the job as?

  • 1.  Anyone using bsubmit and if so any idea where in the esub environment you can find the username that was passed to run the job as?

    Posted Wed July 28, 2021 10:43 AM
    We came across the bsubmit utility recently and it looks useful. lsf-utils/bsubmit at master · IBMSpectrumComputing/lsf-utils
    GitHub remove preview
    lsf-utils/bsubmit at master · IBMSpectrumComputing/lsf-utils
    bsubmit is a wrapper of bsub. It allows users to submit jobs as another user. If you would like to contribute, you must follow the DCO process in the attached DCO Readme file in the root of this repository.
    View this on GitHub >

     The issue we have run into is we do lookups inside our default esub to match the user submitting the job to their default project and apply that to the job to use for later billing.  Right now that is naïvely using $USER to grab who it is.  I kicked up our debugging with the following bits but couldn't find the username that I passed to bsubmit for the jobs.  

    declare -p
    echo "--LSB_SUB_PARM_FILE--"
    cat $LSB_SUB_PARM_FILE
    echo "--LSB_SUB_MODIFY_FILE--"
    cat $LSB_SUB_MODIFY_FILE
    echo "--LSB_SUB_MODIFY_ENVFILE--"
    cat $LSB_SUB_MODIFY_ENVFILE

    So I guess is there somewhere else I should be looking for this to be stored going through the esub?  I'm in no way tied to using $USER for the lookups it was just the first thing we used that worked.  I could easily add a check to see if it was being submitted to run as someone else and if so use that instead of the account submitting the job.  Just not finding where that info exists in the esub environment and I haven't read cpp in a decade or more so I went crosseyed trying to sort it out in the source.

    ------------------------------
    Robert Lines
    ------------------------------

    #SpectrumComputingGroup


  • 2.  RE: Anyone using bsubmit and if so any idea where in the esub environment you can find the username that was passed to run the job as?

    Posted Thu July 29, 2021 01:53 AM
    Hi, Robert,
    My proposed way is to use `id -u -n` to get the user name you specified in "bsubmit --user" and keep $USER as the command line trigger user in esub script.

    Regards,
    Xun

    ------------------------------
    Xun Pan
    ------------------------------



  • 3.  RE: Anyone using bsubmit and if so any idea where in the esub environment you can find the username that was passed to run the job as?

    Posted Thu July 29, 2021 11:15 AM
    One way is to create a wrapper for bsubmit. In the wrapper you parse -user and set an environment variable something like LSB_SUB_MAP_USER, then in esub to check the environment variable.


    ------------------------------
    YI SUN
    ------------------------------