# Port ctrl_pool to log package

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
2
• Sprint:
DRP S17-1
• Team:
Data Release Production

#### Description

Remove pex_logging dependency in ctrl_pool.

#### Activity

Hide
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 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
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
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
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
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
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
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
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
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:
Perry Gee
Reporter:
Hsin-Fang Chiang
Reviewers:
Paul Price
Watchers:
Andy Salnikov, Hsin-Fang Chiang, John Swinbank, Kian-Tat Lim, Paul Price, Perry Gee