<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
  <head>
  <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Load a Registry from the File System — loadRegistry • batchtools</title>


<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<!-- Bootstrap -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>

<!-- bootstrap-toc -->
<link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script>

<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />

<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>

<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>

<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>




<meta property="og:title" content="Load a Registry from the File System — loadRegistry" />
<meta property="og:description" content="Loads a registry from its file.dir.
Multiple R sessions accessing the same registry simultaneously can lead to database inconsistencies.
This is especially dangerous if the same file.dir is accessed from multiple machines, e.g. via a mount.
If you just need to check on the status or peek into some preliminary results while another process is still submitting or waiting
for pending results, you can load the registry in a read-only mode.
All operations that need to change the registry will raise an exception in this mode.
Files communicated back by the computational nodes are parsed to update the registry in memory while the registry on the file system remains unchanged.
A heuristic tries to detect if the registry has been altered in the background by an other process and in this case automatically restricts the current registry to read-only mode.
However, you should rely on this heuristic to work flawlessly.
Thus, set to writeable to TRUE if and only if you are absolutely sure that other state-changing processes are terminated.
If you need write access, load the registry with writeable set to TRUE." />




<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>

<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->



  </head>

  <body data-spy="scroll" data-target="#toc">
    <div class="container template-reference-topic">
      <header>
      <div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">batchtools</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.9.14</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li>
  <a href="../index.html">
    <span class="fas fa fas fa-home fa-lg"></span>
     
  </a>
</li>
<li>
  <a href="../articles/batchtools.html">Get started</a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li>
  <a href="../news/index.html">Changelog</a>
</li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
  <a href="https://github.com/mllg/batchtools/">
    <span class="fab fa fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
      
    </div><!--/.nav-collapse -->
  </div><!--/.container -->
</div><!--/.navbar -->

      

      </header>

<div class="row">
  <div class="col-md-9 contents">
    <div class="page-header">
    <h1>Load a Registry from the File System</h1>
    <small class="dont-index">Source: <a href='https://github.com/mllg/batchtools/blob/master/R/loadRegistry.R'><code>R/loadRegistry.R</code></a></small>
    <div class="hidden name"><code>loadRegistry.Rd</code></div>
    </div>

    <div class="ref-description">
    <p>Loads a registry from its <code>file.dir</code>.</p>
<p>Multiple R sessions accessing the same registry simultaneously can lead to database inconsistencies.
This is especially dangerous if the same <code>file.dir</code> is accessed from multiple machines, e.g. via a mount.</p>
<p>If you just need to check on the status or peek into some preliminary results while another process is still submitting or waiting
for pending results, you can load the registry in a read-only mode.
All operations that need to change the registry will raise an exception in this mode.
Files communicated back by the computational nodes are parsed to update the registry in memory while the registry on the file system remains unchanged.</p>
<p>A heuristic tries to detect if the registry has been altered in the background by an other process and in this case automatically restricts the current registry to read-only mode.
However, you should rely on this heuristic to work flawlessly.
Thus, set to <code>writeable</code> to <code>TRUE</code> if and only if you are absolutely sure that other state-changing processes are terminated.</p>
<p>If you need write access, load the registry with <code>writeable</code> set to <code>TRUE</code>.</p>
    </div>

    <pre class="usage"><span class='fu'>loadRegistry</span><span class='op'>(</span>
  <span class='va'>file.dir</span>,
  work.dir <span class='op'>=</span> <span class='cn'>NULL</span>,
  conf.file <span class='op'>=</span> <span class='fu'><a href='findConfFile.html'>findConfFile</a></span><span class='op'>(</span><span class='op'>)</span>,
  make.default <span class='op'>=</span> <span class='cn'>TRUE</span>,
  writeable <span class='op'>=</span> <span class='cn'>FALSE</span>
<span class='op'>)</span></pre>

    <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
    <table class="ref-arguments">
    <colgroup><col class="name" /><col class="desc" /></colgroup>
    <tr>
      <th>file.dir</th>
      <td><p>[<code><a href='https://rdrr.io/r/base/character.html'>character(1)</a></code>]<br />
  Path where all files of the registry are saved.
  Default is directory &#8220;registry&#8221; in the current working directory.
  The provided path will get normalized unless it is given relative to the home directory
  (i.e., starting with &#8220;~&#8221;). Note that some templates do not handle relative paths well.</p>
<p>If you pass <code>NA</code>, a temporary directory will be used.
  This way, you can create disposable registries for <code><a href='btlapply.html'>btlapply</a></code> or examples.
  By default, the temporary directory <code><a href='https://rdrr.io/r/base/tempfile.html'>tempdir</a>()</code> will be used.
  If you want to use another directory, e.g. a directory which is shared between nodes,
  you can set it in your configuration file by setting the variable <code>temp.dir</code>.</p></td>
    </tr>
    <tr>
      <th>work.dir</th>
      <td><p>[<code><a href='https://rdrr.io/r/base/character.html'>character(1)</a></code>]<br />
  Working directory for R process for running jobs.
  Defaults to the working directory currently set during Registry construction (see <code><a href='https://rdrr.io/r/base/getwd.html'>getwd</a></code>).
  <code>loadRegistry</code> uses the stored <code>work.dir</code>, but you may also explicitly overwrite it,
  e.g., after switching to another system.</p>
<p>The provided path will get normalized unless it is given relative to the home directory
  (i.e., starting with &#8220;~&#8221;). Note that some templates do not handle relative paths well.</p></td>
    </tr>
    <tr>
      <th>conf.file</th>
      <td><p>[<code><a href='https://rdrr.io/r/base/character.html'>character(1)</a></code>]<br />
  Path to a configuration file which is sourced while the registry is created.
  In the configuration file you can define how <span class="pkg">batchtools</span> interacts with the system via <code><a href='makeClusterFunctions.html'>ClusterFunctions</a></code>.
  Separating the configuration of the underlying host system from the R code allows to easily move computation to another site.</p>
<p>The file lookup is implemented in the internal (but exported) function <code>findConfFile</code> which returns the first file found of the following candidates:</p><ol>
<li><p>File &#8220;batchtools.conf.R&#8221; in the path specified by the environment variable &#8220;R_BATCHTOOLS_SEARCH_PATH&#8221;.</p></li>
<li><p>File &#8220;batchtools.conf.R&#8221; in the current working directory.</p></li>
<li><p>File &#8220;config.R&#8221; in the user configuration directory as reported by <code><a href='https://rdrr.io/pkg/rappdirs/man/user_data_dir.html'>rappdirs::user_config_dir("batchtools", expand = FALSE)</a></code> (depending on OS, e.g., on linux this usually resolves to &#8220;~/.config/batchtools/config.R&#8221;).</p></li>
<li><p>&#8220;.batchtools.conf.R&#8221; in the home directory (&#8220;~&#8221;).</p></li>
<li><p>&#8220;config.R&#8221; in the site config directory as reported by <code><a href='https://rdrr.io/pkg/rappdirs/man/site_data_dir.html'>rappdirs::site_config_dir("batchtools")</a></code> (depending on OS). This file can be used for admins to set sane defaults for a computation site.</p></li>
</ol><p>Set to <code>NA</code> if you want to suppress reading any configuration file.
  If a configuration file is found, it gets sourced inside the environment of the registry after the defaults for all variables are set.
  Therefore you can set and overwrite slots, e.g. <code>default.resources = list(walltime = 3600)</code> to set default resources or &#8220;max.concurrent.jobs&#8221; to
  limit the number of jobs allowed to run simultaneously on the system.</p></td>
    </tr>
    <tr>
      <th>make.default</th>
      <td><p>[<code><a href='https://rdrr.io/r/base/logical.html'>logical(1)</a></code>]<br />
If set to <code>TRUE</code>, the created registry is saved inside the package
namespace and acts as default registry. You might want to switch this
off if you work with multiple registries simultaneously.
Default is <code>TRUE</code>.</p></td>
    </tr>
    <tr>
      <th>writeable</th>
      <td><p>[<code><a href='https://rdrr.io/r/base/logical.html'>logical(1)</a></code>]<br />
Loads the registry in read-write mode. Default is <code>FALSE</code>.</p></td>
    </tr>
    </table>

    <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>

    <p>[<code><a href='makeRegistry.html'>Registry</a></code>].</p>
    <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2>

    <div class='dont-index'><p>Other Registry: 
<code><a href='clearRegistry.html'>clearRegistry</a>()</code>,
<code><a href='getDefaultRegistry.html'>getDefaultRegistry</a>()</code>,
<code><a href='makeRegistry.html'>makeRegistry</a>()</code>,
<code><a href='removeRegistry.html'>removeRegistry</a>()</code>,
<code><a href='saveRegistry.html'>saveRegistry</a>()</code>,
<code><a href='sweepRegistry.html'>sweepRegistry</a>()</code>,
<code><a href='syncRegistry.html'>syncRegistry</a>()</code></p></div>

  </div>
  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
    <nav id="toc" data-toggle="toc" class="sticky-top">
      <h2 data-toc-skip>Contents</h2>
    </nav>
  </div>
</div>


      <footer>
      <div class="copyright">
  <p>Developed by Michel Lang, Bernd Bischl.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
</div>

      </footer>
   </div>

  


  </body>
</html>


