title: How to override hydra working dir from within a script?
body: <p>I know that I can change the working dir in config by setting <code>hydra.run.dir=XXX</code> from the command line.
  But how to do it properly from script w/o using CLI arguments in a way that even the logs are saved in the dir which I set?</p>
  <p>This code won't work because:</p>
  <ol>
  <li>the hydra and its loggers are already initialized when I try to change the dir and</li>
  <li>there is no such attribute <code>cfg.hydra</code>.</li>
  </ol>
  <p><strong>UPD</strong>: I got a pointer in the comments. I could change the hydra parameters in the block <code>if  __name__ == 'main':</code> before hydra is called. But how to get access and modify <code>hydra.run.dir</code> from the script?</p>
  <pre class="lang-py prettyprint-override"><code>    @hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
      def main(cfg):
          cfg.hydra.run.dir = &quot;./c_out/cached_loss&quot;  # no such attribute
          logger.info('I log something')
  </code></pre>
  <p>My hydra config looks like this:</p>
  <pre class="lang-yaml prettyprint-override"><code>defaults:                     
    - hydra/job_logging: custom_logging 
  </code></pre>
  <pre class="lang-yaml prettyprint-override"><code># hydra/custom_logging.yaml
  # python logging configuration for tasks                           
  version: 1                                                         
  formatters:                                                        
    simple:                                                          
      format: '[%(asctime)s][%(name)s][%(levelname)s] - %(message)s' 
  handlers:                                                          
    console:                                                         
      class: logging.StreamHandler                                   
      formatter: simple                                              
      stream: ext://sys.stdout                                       
    file:                                                            
      class: logging.FileHandler                                     
      formatter: simple                                              
      # relative to the job log directory                            
      filename: ${hydra.job.name}.log                                
  root:                                                              
    level: INFO                                                      
    handlers: [console, file]                                        
                                                                     
  disable_existing_loggers: false                                    
  </code></pre>