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

Port ctrl_pool to log package

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: ctrl_pool
    • Labels:
      None

      Description

      Remove pex_logging dependency in ctrl_pool.

        Attachments

          Issue Links

            Activity

            Hide
            salnikov Andy Salnikov added a comment -

            Perry Gee, 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.

            Show
            salnikov Andy Salnikov added a comment - Perry Gee , 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.
            Hide
            pgee Perry Gee added a comment -

            Paul 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.

            Show
            pgee Perry Gee added a comment - Paul 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.
            Hide
            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.

            Show
            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.
            Hide
            pgee Perry Gee added a comment -

            Paul 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.

            Show
            pgee Perry Gee added a comment - Paul 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.
            Hide
            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.

            Show
            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

              Assignee:
              pgee Perry Gee
              Reporter:
              hchiang2 Hsin-Fang Chiang
              Reviewers:
              Paul Price
              Watchers:
              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.