Commit 0a3dd01f authored by jtchilders's avatar jtchilders
Browse files

changed id to job_id, change serialize method of balsam job

parent 6b5a4867
import common.Serializer as Serializer
from django.core import serializers
import logging,sys
logger = logging.getLogger(__name__)
from common import Serializer
class SerializeFailed(Exception): pass
class DeserializeFailed(Exception): pass
class BalsamJobStatus:
def __init__(self,job=None,message=None): = None
self.job_id = None
self.serialized_job = None
self.message = message
if job is not None:
def set_job(self,job): = job.balsam_job_id
self.job_id = job.job_id
self.serialized_job = serializers.serialize('json',[job])
self.serialized_job = job.serialize()
except Exception,e:
logger.exception('serialize failed: ' + str(job.__dict__))
raise SerializeFailed('Received exception while serializing BalsamJob')
def get_job(self):
def get_job(self,job):
if self.serialized_job is not None:
balsam_jobs = serializers.deserialize('json',self.serialized_job)
return job
except Exception,e:
logger.exception('deserialize failed: ' + str(self.serialized_job))
raise DeserializeFailed('Received exception while deserializing BalsamJob')
......@@ -42,7 +42,7 @@ class BalsamJobStatus:
def deserialize(self,text):
self.__dict__ = Serializer.deserialize(text) = int(str(
self.job_id = int(str(self.job_id))
except Exception,e:
logger.exception('deserialize failed')
raise DeserializeFailed('Received exception while deserializing BalsamJobStatus: ' + str(e))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment