https://dev.arvados.org/https://dev.arvados.org/favicon.ico?15576888422014-07-04T16:12:36ZArvadosArvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=120392014-07-04T16:12:36ZTom Cleggtom@curii.com
<ul><li><strong>Target version</strong> set to <i>Arvados Future Sprints</i></li></ul> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=127642014-07-26T14:35:19ZTom Cleggtom@curii.com
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/12764/diff?detail_id=11253">diff</a>)</li></ul> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=127652014-07-26T14:35:41ZTom Cleggtom@curii.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li><li><strong>Assigned To</strong> set to <i>Tom Clegg</i></li></ul> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=127662014-07-26T14:37:55ZTom Cleggtom@curii.com
<ul></ul><p>Started 2800-python-global-state branch.</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137512014-08-16T18:56:28ZTom Cleggtom@curii.com
<ul></ul><p>On 2800-pgs branch at <a class="changeset" title="2800: Clean up exceptions, variable names, handling of discoveryServiceUrl vs host args." href="https://dev.arvados.org/projects/arvados/repository/arvados/revisions/c5f8a89d3b0a8038a31b0af049f3610b6374b6a8">c5f8a89</a></p>
Interface
<ul>
<li>Accept host, token, and insecure arguments in the <code>api()</code> call. If provided, use them rather than looking up environment variables.
<ul>
<li>This change obsoletes some awkward maneuvers with environment variables (some of this removed from <code>tests/test_api.py</code>).</li>
</ul></li>
</ul>
Caching
<ul>
<li><code>arvados.api()</code> no longer returns a cached connection object with different credentials, endpoint, or "insecure" flag than the connection being requested. (Caching code used to assume only the requested version could change between calls to <code>api()</code>.)
<ul>
<li>Example: this change makes it unnecessary for <code>tests/test_api.py</code> to clear the connection cache to prevent accidental future use of its fake credentials. Removed.</li>
</ul>
</li>
<li>If the caller says <code>cache=False</code>, don't use an existing connection (as before), but don't put the newly created connection object in the cache either.</li>
</ul>
Token handling
<ul>
<li>The credentials supplied to (or looked up by) <code>arvados.api()</code> are used for the life of the connection it returns. Previously, CredentialsFromEnv looked up the auth token in the global os.environ during each API method call.</li>
</ul>
Mocking
<ul>
<li><code>test_api.py</code> uses a mock for API requests but still needs a discovery document. Now it uses <code>run_test_server.py</code> instead of relying on qr1hi.arvadosapi.com. This makes the test suite slower but more meaningful.</li>
</ul> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137542014-08-17T16:45:31ZTom Cleggtom@curii.com
<ul><li><strong>Target version</strong> changed from <i>Arvados Future Sprints</i> to <i>2014-08-27 Sprint</i></li></ul><p>(The issue of using Keep services at multiple sites (<code>global_client_object</code> in <code>keep.py</code>) hasn't been addressed yet.)</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137762014-08-18T12:20:35ZBrett Smithbrett.smith@curii.com
<ul></ul><p>Just a few small comments on <a class="changeset" title="2800: Clean up exceptions, variable names, handling of discoveryServiceUrl vs host args." href="https://dev.arvados.org/projects/arvados/repository/arvados/revisions/c5f8a89d3b0a8038a31b0af049f3610b6374b6a8">c5f8a89</a></p>
<ul>
<li>We can skip the step of hashing strings for a cache key. We can just create a tuple of all the values we care about, and use that directly as the lookup key. What do you think of that approach?</li>
<li>Please keep imports sorted alphabetically.</li>
<li>Please retain the comment in <code>test_api.py</code> about needing a real discovery document, to explain why we're running a test server.</li>
</ul>
<p>Thanks.</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137852014-08-18T14:07:06ZTom Cleggtom@curii.com
<ul></ul><p>Brett Smith wrote:</p>
<blockquote>
<ul>
<li>We can skip the step of hashing strings for a cache key. We can just create a tuple of all the values we care about, and use that directly as the lookup key. What do you think of that approach?</li>
</ul>
</blockquote>
<p>Ah, yes, I was limiting myself to string keys for no reason. Now using tuple as dictionary key.</p>
<blockquote>
<ul>
<li>Please keep imports sorted alphabetically.</li>
</ul>
</blockquote>
<p>Fixed (by not importing hashlib)</p>
<blockquote>
<ul>
<li>Please retain the comment in <code>test_api.py</code> about needing a real discovery document, to explain why we're running a test server.</li>
</ul>
</blockquote>
<p>Indeed. Restored.</p>
<p>Thanks... now at <a class="changeset" title="2800: Restore deleted comment which is still relevant." href="https://dev.arvados.org/projects/arvados/repository/arvados/revisions/1e368708ad2a2d553f5e716c473767c660b2f805">1e36870</a></p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137932014-08-18T14:23:16ZBrett Smithbrett.smith@curii.com
<ul></ul><p>Tom Clegg wrote:</p>
<blockquote>
<p>Brett Smith wrote:</p>
<blockquote>
<ul>
<li>Please keep imports sorted alphabetically.</li>
</ul>
</blockquote>
<p>Fixed (by not importing hashlib)</p>
</blockquote>
<p>This is still an issue in <code>test_api.py</code>. Everything else looks good, so please go ahead and merge with that change. Thanks.</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=137942014-08-18T14:28:24ZTom Cleggtom@curii.com
<ul></ul><p>Fixed in <a class="changeset" title="2800: Sort import statements." href="https://dev.arvados.org/projects/arvados/repository/arvados/revisions/47dc22e10fe234df3da76abdb9e704b01d57427d">47dc22e</a>. Thanks!</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=138382014-08-20T09:55:25ZBrett Smithbrett.smith@curii.com
<ul><li><strong>Assigned To</strong> changed from <i>Tom Clegg</i> to <i>Brett Smith</i></li></ul><p>2800-pysdk-no-global-keep-client-wip is up for review to deprecate the global Keep client.</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=138572014-08-20T14:20:09ZBrett Smithbrett.smith@curii.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li><li><strong>% Done</strong> changed from <i>33</i> to <i>100</i></li></ul><p>Applied in changeset arvados|commit:05bea2c50474edeb9d0e3fb8daaf838b58ea9a54.</p> Arvados - Bug #2800: [Crunch] Remove global state in Python SDKhttps://dev.arvados.org/issues/2800?journal_id=139402014-08-22T14:06:44ZWard Vandewegeward@curii.com
<ul><li><strong>Subject</strong> changed from <i>Remove global state in Python SDK</i> to <i>[Crunch] Remove global state in Python SDK</i></li></ul>