[ARVADOS] created: 202622a47e9c300341be4cbd81484b02360897ab

git at public.curoverse.com git at public.curoverse.com
Tue Jan 21 17:04:06 EST 2014


        at  202622a47e9c300341be4cbd81484b02360897ab (commit)


commit 202622a47e9c300341be4cbd81484b02360897ab
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 20 07:41:39 2014 -0800

    Cache discovery document in ~/.cache/arvados/discovery/.
    
    refs #1922

diff --git a/sdk/python/arvados/__init__.py b/sdk/python/arvados/__init__.py
index dacdba8..18bde85 100644
--- a/sdk/python/arvados/__init__.py
+++ b/sdk/python/arvados/__init__.py
@@ -129,6 +129,14 @@ def _cast_objects_too(value, schema_type):
         return _cast_orig(value, schema_type)
 apiclient.discovery._cast = _cast_objects_too
 
+def http_cache(data_type):
+    path = os.environ['HOME'] + '/.cache/arvados/' + data_type
+    try:
+        util.mkdir_dash_p(path)
+    except OSError:
+        path = None
+    return path
+
 def api(version=None):
     global services, config
     if not services.get(version):
@@ -149,7 +157,8 @@ def api(version=None):
         if not os.path.exists(ca_certs):
             ca_certs = None             # use httplib2 default
 
-        http = httplib2.Http(ca_certs=ca_certs)
+        http = httplib2.Http(ca_certs=ca_certs,
+                             cache=http_cache('discovery'))
         http = credentials.authorize(http)
         if re.match(r'(?i)^(true|1|yes)$',
                     config.get('ARVADOS_API_HOST_INSECURE', 'no')):

commit 391d87d025449737ad6c7836ae66a980aef4c57a
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Jan 20 07:41:12 2014 -0800

    Set cache expiry time on discovery document.
    
    refs #1922

diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index 0baa865..96e4323 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -23,6 +23,7 @@ class Arvados::V1::SchemaController < ApplicationController
   end
 
   def discovery_rest_description
+    expires_in 24.hours, public: true
     discovery = Rails.cache.fetch 'arvados_v1_rest_discovery' do
       Rails.application.eager_load!
       discovery = {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list