Commit 5649d424 authored by Aurélien Dunand's avatar Aurélien Dunand
Browse files

Add a tag for job type

This tag won't work on previous job as we miss information about the job
instance used in the job pickled data file. So instead return unkown for
those old jobs.
parent dfc1f265
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ class JobState(object):

        # Bound to the job itself:
        self._job = job_class(self.logger, self, **settings)
        self._job_type = self._job.job_type()

    def _check_freeze(self):
        """ Raise FreezedJobError if object is freezed.
@@ -128,6 +129,13 @@ class JobState(object):
    def jid(self):
        return self._job_id.rsplit('-')[-1]

    @property
    def type(self):
        try:
            return self._job_type
        except AttributeError:
            return 'unknown'

    @property
    def system(self):
        return self._system
@@ -315,3 +323,8 @@ class Job(Thread, object):
        """ Method to override in order to define the job behavior.
        """
        pass

    def job_type(self):
        """
        """
        return 'undefined'