Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekziade committed Aug 13, 2013
1 parent a333934 commit fd9de1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions loads/db/_redis.py
Expand Up @@ -25,11 +25,14 @@ def _initialize(self):
#
def save_metadata(self, run_id, metadata):
key = 'metadata:%s' % run_id
self._redis.set(key, loads(metadata))
self._redis.set(key, dumps(metadata))

def get_metadata(self, run_id):
key = 'metadata:%s' % run_id
return loads(self._redis.get(key))
metadata = self._redis.get(key)
if metadata is None:
return {}
return loads(metadata)

def add(self, data):
if 'run_id' not in data:
Expand Down
4 changes: 4 additions & 0 deletions loads/transport/broker.py
Expand Up @@ -7,6 +7,7 @@
import os
import json
from uuid import uuid4
import time

import zmq.green as zmq
from zmq.green.eventloop import ioloop, zmqstream
Expand Down Expand Up @@ -216,6 +217,9 @@ def _handle_recv_front(self, msg, tentative=0):

msg[2] = json.dumps(data)

# notice when the test was started
data['args']['started'] = time.time()

# save the tests metadata in the db
self.ctrl.save_metadata(run_id, data['args'])
self.ctrl.flush_db()
Expand Down

0 comments on commit fd9de1f

Please sign in to comment.