(job_data1, job_data2)
return job_data1.last_end < job_data2.last_end
A comparator for job data objects.

        Jobs are sorted based on the execution time.  Finished jobs sort on the
        end time.  A running job sorts after a finished job.  Running jobs sort
        on the start time.  Jobs that never run sort on qualified name.
A comparator for job data objects.
A comparator for job data objects .
def _job_data_less_than(job_data1, job_data2):
        """A comparator for job data objects.

        Jobs are sorted based on the execution time.  Finished jobs sort on the
        end time.  A running job sorts after a finished job.  Running jobs sort
        on the start time.  Jobs that never run sort on qualified name.
        """
        if (not job_data1.last_start and not job_data2.last_start and
                not job_data1.last_end and not job_data2.last_end):
            # neither job ever run
            name1 = Name(workflow=job_data1.workflow,
                         instance=job_data1.instance,
                         job_state=Name.WAITING_STATE,
                         job=job_data1.job).get_job_token_name()
            name2 = Name(workflow=job_data2.workflow,
                         instance=job_data2.instance,
                         job_state=Name.WAITING_STATE,
                         job=job_data2.job).get_job_token_name()
            return name1 < name2

        if not job_data1.last_start and job_data2.last_start:
            # job1 never run, job2 did
            return True
        if job_data1.last_start and not job_data2.last_start:
            # job2 never run, job1 did
            return False
        if not job_data1.last_end and not job_data2.last_end:
            # both jobs are running
            return job_data1.last_start < job_data2.last_start
        if not job_data1.last_end and job_data2.last_end:
            # only job1 is running
            return False
        if job_data1.last_end and not job_data2.last_end:
            # only job2 is running
            return True
        # both jobs run in the past but neither is running now
        return job_data1.last_end < job_data2.last_end
def _job_data_less_than ( job_data1 , job_data2 ) : if ( not job_data1 . last_start and not job_data2 . last_start and not job_data1 . last_end and not job_data2 . last_end ) : # neither job ever run name1 = Name ( workflow = job_data1 . workflow , instance = job_data1 . instance , job_state = Name . WAITING_STATE , job = job_data1 . job ) . get_job_token_name ( ) name2 = Name ( workflow = job_data2 . workflow , instance = job_data2 . instance , job_state = Name . WAITING_STATE , job = job_data2 . job ) . get_job_token_name ( ) return name1 < name2 if not job_data1 . last_start and job_data2 . last_start : # job1 never run, job2 did return True if job_data1 . last_start and not job_data2 . last_start : # job2 never run, job1 did return False if not job_data1 . last_end and not job_data2 . last_end : # both jobs are running return job_data1 . last_start < job_data2 . last_start if not job_data1 . last_end and job_data2 . last_end : # only job1 is running return False if job_data1 . last_end and not job_data2 . last_end : # only job2 is running return True # both jobs run in the past but neither is running now return job_data1 . last_end < job_data2 . last_end