Beispiel #1
0
def scan_inode_distributed(case, inode_id, scanners, cookie):
    """ Schedules a job to scan the inode by an available worker.

    Note this will actually happen out of process.
    """
    Farm.post_job('Scan', dict(case=case, inode_id=inode_id, scanners=scanners), cookie)
    return

    #return scan_inode(case, inode_id, factories, cookie)
    pdbh = DB.DBO()

    ## We require that all scanning calls have a valid cookie. The
    ## following helps to trap bugs by scanners not passing the cookie
    ## along.
    if cookie == 0:
        raise RuntimeError( "Invalid cookie")
    ## This is a cookie used to identify our requests so that we
    ## can check they have been done later.
    pdbh.insert("jobs",
                command = 'Scan',
                arg1 = case,
                arg2 = inode_id,
                arg3 = ','.join([f.name for f in factories]),
                cookie=cookie,
                _fast = True
                )
    
    ## This is running in the worker itself - we can not wake up the
    ## other workers from here.
    Farm.wake_workers()
Beispiel #2
0
def render_html(self, inode_id, table_renderer):
    Farm.post_job("Export", dict(case=self.case, inode_id=inode_id))

    filename, content_type, fd = table_renderer.make_archive_filename(inode_id)
    result = "<a href='%s'>%s</a><br />" % (filename, fd.inode_id)
    
    try:
        filename = "inodes/%s_summary.html" % inode_id
        fd.html_export
        result += "<a href='%s'><img src=images/browse.png /></a>" % (filename,)
    except AttributeError: pass

    #if table_renderer.explain_inodes:
    ## Add a link to the explaination page:
    filename = "inodes/%s_explain.html" % inode_id
    result+="<a href='%s'><img src=images/question.png /></a>" %(filename,)

    ## Check if there are annotations for this
    dbh = DB.DBO(self.case)
    dbh.execute("select * from annotate where inode_id=%r", inode_id)
    for row in dbh:
        result += "<br>%s" % row['note']

    return result