示例#1
0
def update_blackboard_entry(job_ad, logger=None):
    """
    Update the Blackboard entry corresponding to the given Job ClassAd.
    """
    from owl.classad import Job
    from owl import blackboard

    # Create a Job instance from the ClassAd and use it to update the BB.
    blackboard.updateEntry(Job.new_from_classad(job_ad))
    return
示例#2
0
def update_blackboard_entry(job_ad, logger=None):
    """
    Update the Blackboard entry corresponding to the given Job ClassAd.
    """
    from owl.classad import Job
    from owl import blackboard


    # Create a Job instance from the ClassAd and use it to update the BB.
    blackboard.updateEntry(Job.new_from_classad(job_ad))
    return
示例#3
0
def close_blackboard_entry(job_ad, logger=None):
    """
    Close the Blackboard entry corresponding to the given Job ClassAd.
    """
    from owl.classad import Job
    from owl import blackboard

    # Create a Job instance from the ClassAd.
    job = Job.new_from_classad(job_ad)

    # Make sure that the job CompletionDate is not 0 (as it seems to be all the
    # time).
    if (not hasattr(job, 'CompletionDate') or job.CompletionDate == 0):
        job.CompletionDate = job.JobStartDate + job.JobDuration
        if (logger):
            logger.debug(
                'CompletionDate = 0 in an exit hook: setting it to %d' %
                (job.CompletionDate))

    # Close the Blackboard entry corresponding to job.
    blackboard.closeEntry(job)
    return
示例#4
0
def close_blackboard_entry(job_ad, logger=None):
    """
    Close the Blackboard entry corresponding to the given Job ClassAd.
    """
    from owl.classad import Job
    from owl import blackboard


    # Create a Job instance from the ClassAd.
    job = Job.new_from_classad(job_ad)

    # Make sure that the job CompletionDate is not 0 (as it seems to be all the
    # time).
    if(not hasattr(job, 'CompletionDate') or job.CompletionDate == 0):
        job.CompletionDate = job.JobStartDate + job.JobDuration
        if(logger):
            logger.debug('CompletionDate = 0 in an exit hook: setting it to %d'
                         % (job.CompletionDate))

    # Close the Blackboard entry corresponding to job.
    blackboard.closeEntry(job)
    return
示例#5
0
def create_blackboard_entry(job_ad, logger=None):
    """
    Create a new Blackboard entry from `job_ad`. In case a Blackboard entry with
    the same GlobalJobId already exists (which would happen e.g. in a rescue
    DAG), fallback to an update.
    """
    from owl.classad import Job
    from owl import blackboard

    # Now, we could be in a rescue DAG, meaning that the blackboard entry might
    # already be there. If this is the case, we just update that entry and not
    # create a new one.
    entry = None
    job = Job.new_from_classad(job_ad)
    try:
        entry = blackboard.getEntry(entryId=job.GlobalJobId)
    except:
        pass

    if (entry):
        update_blackboard_entry(job_ad, logger)
    else:
        blackboard.createEntry(job)
    return
示例#6
0
def create_blackboard_entry(job_ad, logger=None):
    """
    Create a new Blackboard entry from `job_ad`. In case a Blackboard entry with
    the same GlobalJobId already exists (which would happen e.g. in a rescue
    DAG), fallback to an update.
    """
    from owl.classad import Job
    from owl import blackboard

    # Now, we could be in a rescue DAG, meaning that the blackboard entry might
    # already be there. If this is the case, we just update that entry and not
    # create a new one.
    entry = None
    job = Job.new_from_classad(job_ad)
    try:
        entry = blackboard.getEntry(entryId=job.GlobalJobId)
    except:
        pass

    if(entry):
        update_blackboard_entry(job_ad, logger)
    else:
        blackboard.createEntry(job)
    return