[ARVADOS] updated: 17e8c59deca04137f66ece7837f96599ff82f4de

git at public.curoverse.com git at public.curoverse.com
Mon Jul 20 15:56:22 EDT 2015


Summary of changes:
 .../app/views/users/_manage_repositories.html.erb  |   1 +
 .../test/integration/user_manage_account_test.rb   |   2 +
 doc/images/add-new-repository.png                  | Bin 10026 -> 9575 bytes
 doc/images/added-new-repository.png                | Bin 0 -> 14210 bytes
 .../install-shell-server.html.textile.liquid       |  13 ++++++
 .../add-new-repository.html.textile.liquid         |  10 ++--
 .../tutorial-submit-job.html.textile.liquid        |  13 +++++-
 sdk/python/arvados/events.py                       |  18 ++++---
 sdk/python/arvados/util.py                         |  18 +++----
 sdk/python/tests/test_util.py                      |  18 ++++++-
 sdk/python/tests/test_websockets.py                |  52 ++++++++++++++++-----
 services/api/config/initializers/load_config.rb    |  12 ++---
 12 files changed, 113 insertions(+), 44 deletions(-)
 create mode 100644 doc/images/added-new-repository.png

       via  17e8c59deca04137f66ece7837f96599ff82f4de (commit)
       via  6e5e1c725a10ea791f00d073003175ac3c29a6c7 (commit)
       via  b23101649f5320c7f4f5c68f3d7745373e316249 (commit)
       via  ee29db4af2c800924fa06b7bbc1f3058ba3cfb94 (commit)
       via  70e832c1c5976614c4da5c2987ecba7217c3e83a (commit)
       via  e0ab53eaacc78f74e3f446f2cd5f58b8add29898 (commit)
       via  f7c152d3ca9a753812bd7729ceb6cb8a23b12fce (commit)
       via  0b19163c8633defab5988f8b775833d3358ebaaf (commit)
       via  4a35a164fcddb66e04df2afe4686783fd3b35510 (commit)
       via  37e6d6e690446496a43ea7d3da48cb145c2e9628 (commit)
       via  edb109c244d25fb9a963a2146953710fd4d77099 (commit)
       via  caa9e89d531f03838e64d36d050be9d96e7c6c96 (commit)
       via  1d5e009a31e0b462b7bfcf4c0e5dc36db423c90f (commit)
       via  78e3248417510aecbac9e66a22d48e32a80181bf (commit)
       via  61187968f0e9268430b967ce37a79d9384ec7e3c (commit)
       via  77aeb6fdedab3d2aac25120e5a99317155c9f26e (commit)
       via  94afae23dd927b2d9d6c3472f90bc00f0310bbf5 (commit)
       via  a1e6ebc7e1afc04e8a1de0c0bb8e304eda6ecf2c (commit)
       via  acacdd86095218aa2bb4cc4cd564d9d7f135da3c (commit)
       via  db2584826ed9aadb162b8bd6d25e164565bbab8b (commit)
      from  84698df0ff6dcd834c080840f5d7e95a1ce086a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 17e8c59deca04137f66ece7837f96599ff82f4de
Author: radhika <radhika at curoverse.com>
Date:   Mon Jul 20 15:39:25 2015 -0400

    6473: PollClient also supports last_log_id argument.

diff --git a/sdk/python/arvados/events.py b/sdk/python/arvados/events.py
index b187200..e319be3 100644
--- a/sdk/python/arvados/events.py
+++ b/sdk/python/arvados/events.py
@@ -53,7 +53,7 @@ class EventClient(WebSocketClient):
         self.send(json.dumps({"method": "unsubscribe", "filters": filters}))
 
 class PollClient(threading.Thread):
-    def __init__(self, api, filters, on_event, poll_time):
+    def __init__(self, api, filters, on_event, poll_time, last_log_id):
         super(PollClient, self).__init__()
         self.api = api
         if filters:
@@ -64,14 +64,18 @@ class PollClient(threading.Thread):
         self.poll_time = poll_time
         self.daemon = True
         self.stop = threading.Event()
+        self.last_log_id = last_log_id
 
     def run(self):
         self.id = 0
-        for f in self.filters:
-            items = self.api.logs().list(limit=1, order="id desc", filters=f).execute()['items']
-            if items:
-                if items[0]['id'] > self.id:
-                    self.id = items[0]['id']
+        if self.last_log_id != None:
+            self.id = self.last_log_id
+        else:
+            for f in self.filters:
+                items = self.api.logs().list(limit=1, order="id desc", filters=f).execute()['items']
+                if items:
+                    if items[0]['id'] > self.id:
+                        self.id = items[0]['id']
 
         self.on_event({'status': 200})
 
@@ -147,6 +151,6 @@ def subscribe(api, filters, on_event, poll_fallback=15, last_log_id=None):
         return _subscribe_websocket(api, filters, on_event, last_log_id)
     except Exception as e:
         _logger.warn("Falling back to polling after websocket error: %s" % e)
-    p = PollClient(api, filters, on_event, poll_fallback)
+    p = PollClient(api, filters, on_event, poll_fallback, last_log_id)
     p.start()
     return p
diff --git a/sdk/python/tests/test_websockets.py b/sdk/python/tests/test_websockets.py
index b0367be..fc246ac 100644
--- a/sdk/python/tests/test_websockets.py
+++ b/sdk/python/tests/test_websockets.py
@@ -37,17 +37,17 @@ class WebsocketTest(run_test_server.TestCaseWithServers):
             arvados.api('v1'), filters,
             events.put, poll_fallback=poll_fallback, last_log_id=last_log_id)
         self.assertIsInstance(self.ws, expect_type)
-        self.assertEqual(200, events.get(True, 10)['status'])
+        self.assertEqual(200, events.get(True, 5)['status'])
         human = arvados.api('v1').humans().create(body={}).execute()
 
         if last_log_id == None or expected == 0:
-            self.assertEqual(human['uuid'], events.get(True, 10)['object_uuid'])
+            self.assertEqual(human['uuid'], events.get(True, 5)['object_uuid'])
             self.assertTrue(events.empty(), "got more events than expected")
         else:
             log_events = []
-            for i in range(0, 10):
+            for i in range(0, 20):
                 try:
-                    event = events.get(True, 10)
+                    event = events.get(True, 5)
                     self.assertTrue(event['object_uuid'] is not None)
                     log_events.append(event['object_uuid'])
                 except:
@@ -61,11 +61,24 @@ class WebsocketTest(run_test_server.TestCaseWithServers):
         self._test_subscribe(
             poll_fallback=False, expect_type=arvados.events.EventClient)
 
-    def test_subscribe_websocket_with_start_time_today(self):
-        now = datetime.today()
+    @mock.patch('arvados.events.EventClient.__init__')
+    def test_subscribe_poll(self, event_client_constr):
+        event_client_constr.side_effect = Exception('All is well')
+        self._test_subscribe(
+            poll_fallback=1, expect_type=arvados.events.PollClient)
+
+    def test_subscribe_websocket_with_start_time_date_only(self):
+        lastHour = datetime.today() - timedelta(hours = 1)
         self._test_subscribe(
             poll_fallback=False, expect_type=arvados.events.EventClient, last_log_id=1,
-                additional_filters=[['created_at', '>=', now.strftime('%Y-%m-%d')]])
+                additional_filters=[['created_at', '>=', lastHour.strftime('%Y-%m-%d')]])
+
+    @mock.patch('arvados.events.EventClient.__init__')
+    def test_poll_websocket_with_start_time_date_only(self, event_client_constr):
+        lastHour = datetime.today() - timedelta(hours = 1)
+        self._test_subscribe(
+            poll_fallback=1, expect_type=arvados.events.PollClient, last_log_id=1,
+                additional_filters=[['created_at', '>=', lastHour.strftime('%Y-%m-%d')]])
 
     def test_subscribe_websocket_with_start_time_last_hour(self):
         lastHour = datetime.today() - timedelta(hours = 1)
@@ -73,6 +86,13 @@ class WebsocketTest(run_test_server.TestCaseWithServers):
             poll_fallback=False, expect_type=arvados.events.EventClient, last_log_id=1,
                 additional_filters=[['created_at', '>=', lastHour.strftime('%Y-%m-%d %H:%M:%S')]])
 
+    @mock.patch('arvados.events.EventClient.__init__')
+    def test_subscribe_poll_with_start_time_last_hour(self, event_client_constr):
+        lastHour = datetime.today() - timedelta(hours = 1)
+        self._test_subscribe(
+            poll_fallback=1, expect_type=arvados.events.PollClient, last_log_id=1,
+                additional_filters=[['created_at', '>=', lastHour.strftime('%Y-%m-%d %H:%M:%S')]])
+
     def test_subscribe_websocket_with_start_time_next_hour(self):
         nextHour = datetime.today() + timedelta(hours = 1)
         with self.assertRaises(Queue.Empty):
@@ -80,6 +100,14 @@ class WebsocketTest(run_test_server.TestCaseWithServers):
                 poll_fallback=False, expect_type=arvados.events.EventClient, last_log_id=1,
                     additional_filters=[['created_at', '>=', nextHour.strftime('%Y-%m-%d %H:%M:%S')]], expected=0)
 
+    @mock.patch('arvados.events.EventClient.__init__')
+    def test_subscribe_poll_with_start_time_next_hour(self, event_client_constr):
+        nextHour = datetime.today() + timedelta(hours = 1)
+        with self.assertRaises(Queue.Empty):
+            self._test_subscribe(
+                poll_fallback=1, expect_type=arvados.events.PollClient, last_log_id=1,
+                    additional_filters=[['created_at', '>=', nextHour.strftime('%Y-%m-%d %H:%M:%S')]], expected=0)
+
     def test_subscribe_websocket_with_start_time_tomorrow(self):
         tomorrow = datetime.today() + timedelta(hours = 24)
         with self.assertRaises(Queue.Empty):
@@ -88,7 +116,9 @@ class WebsocketTest(run_test_server.TestCaseWithServers):
                     additional_filters=[['created_at', '>=', tomorrow.strftime('%Y-%m-%d')]], expected=0)
 
     @mock.patch('arvados.events.EventClient.__init__')
-    def test_subscribe_poll(self, event_client_constr):
-        event_client_constr.side_effect = Exception('All is well')
-        self._test_subscribe(
-            poll_fallback=1, expect_type=arvados.events.PollClient)
+    def test_subscribe_poll_with_start_time_tomorrow(self, event_client_constr):
+        tomorrow = datetime.today() + timedelta(hours = 24)
+        with self.assertRaises(Queue.Empty):
+            self._test_subscribe(
+                poll_fallback=1, expect_type=arvados.events.PollClient, last_log_id=1,
+                    additional_filters=[['created_at', '>=', tomorrow.strftime('%Y-%m-%d')]], expected=0)

commit 6e5e1c725a10ea791f00d073003175ac3c29a6c7
Merge: 37e6d6e b231016
Author: radhika <radhika at curoverse.com>
Date:   Mon Jul 20 14:51:32 2015 -0400

    Merge branch 'master' into 6473-fetch-events-starting-at


commit 37e6d6e690446496a43ea7d3da48cb145c2e9628
Merge: 84698df caa9e89
Author: radhika <radhika at curoverse.com>
Date:   Mon Jul 20 11:36:40 2015 -0400

    Merge branch 'master' into 6473-fetch-events-starting-at


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list