Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-8359

Port ctrl_pool to log package

    XMLWordPrintable

Details

    • Story
    • Status: Done
    • Resolution: Done
    • None
    • ctrl_pool
    • None
    • 2
    • DRP S17-1
    • Data Release Production

    Description

      Remove pex_logging dependency in ctrl_pool.

      Attachments

        Issue Links

          Activity

            pgee, there is an "API" already and it's rather simple to use (but it's not a Python API)

            # define location of config file
            export LSST_LOG_CONFIG=/path/to/config.file
            # define substitutions for variables in config file
            export JOBNAME=job_1234
            export MACHINE=$HOSTNAME
            # run your application
            ./superDuperTask.py --id ...
            

            The reason why we prefer to do it this way is that (as you said yourself) application code should not need to know how logging is handled - where logging output goes to and how it is formatted. Another reason is that by the time your application decides to change logging configuration other parts of application may be already logging something to default-configured logger.

            salnikov Andy Salnikov added a comment - pgee , there is an "API" already and it's rather simple to use (but it's not a Python API) # define location of config file export LSST_LOG_CONFIG= /path/to/config . file # define substitutions for variables in config file export JOBNAME=job_1234 export MACHINE=$HOSTNAME # run your application . /superDuperTask .py -- id ... The reason why we prefer to do it this way is that (as you said yourself) application code should not need to know how logging is handled - where logging output goes to and how it is formatted. Another reason is that by the time your application decides to change logging configuration other parts of application may be already logging something to default-configured logger.
            pgee Perry Gee added a comment -

            price
            Paul: I think that the best solution (consistent with Andy's desires) is to use the environment variables in the properties file. They at least have the advantage that if they don't get set, the variables get set to "" and no particular harm is done.

            I can either set JOBNAME variable from the "job" config parameter passed on the cmdline of ctrlPoolDemo.py, or require that the user set it themselves before starting. I'm not that sure how ctrlPool is used, so I'm not sure if making the setting voluntary on the part of the caller is a good thing or not.

            pgee Perry Gee added a comment - price Paul: I think that the best solution (consistent with Andy's desires) is to use the environment variables in the properties file. They at least have the advantage that if they don't get set, the variables get set to "" and no particular harm is done. I can either set JOBNAME variable from the "job" config parameter passed on the cmdline of ctrlPoolDemo.py, or require that the user set it themselves before starting. I'm not that sure how ctrlPool is used, so I'm not sure if making the setting voluntary on the part of the caller is a good thing or not.
            price Paul Price added a comment -

            If you're going to go that route, I think you should set LSST_JOBNAME from the job argument. Please don't make it the user's responsibility to set it.

            price Paul Price added a comment - If you're going to go that route, I think you should set LSST_JOBNAME from the job argument. Please don't make it the user's responsibility to set it.
            pgee Perry Gee added a comment -

            price Are you done reviewing?

            For whatever reason, there appear to be two logs set up by the old code – one per machine and pid using pex_logging and one using lsst.log.Log. I wanted to know if I should replicate this.

            pgee Perry Gee added a comment - price Are you done reviewing? For whatever reason, there appear to be two logs set up by the old code – one per machine and pid using pex_logging and one using lsst.log.Log. I wanted to know if I should replicate this.
            price Paul Price added a comment -

            Yes, I marked the ticket as "Reviewed".

            Don't worry about the one per machine+PID using pex_logging. I believe the new logger prefixes the hostname+PID into the log file, so they can be disentangled with grep.

            price Paul Price added a comment - Yes, I marked the ticket as "Reviewed". Don't worry about the one per machine+PID using pex_logging. I believe the new logger prefixes the hostname+PID into the log file, so they can be disentangled with grep .

            People

              pgee Perry Gee
              hchiang2 Hsin-Fang Chiang
              Paul Price
              Andy Salnikov, Hsin-Fang Chiang, John Swinbank, Kian-Tat Lim, Paul Price, Perry Gee
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.