示例#1
0
def update_database():
    """A function to be run at some interval to update the qme database listing"""
    while not thread_stop_event.isSet():

        # The data sent to the table depends on the database
        if app.queue.database == "filesystem":

            # Break into executor types and taskids
            message = "use a relational or sqlite database to see more metadata."
            rows = [(x[0].split("-")[0], x[0], message)
                    for x in app.queue.list()]
            socketio.emit(
                "FSdatabase",
                {
                    "rows": rows,
                    "database": app.queue.database
                },
                namespace="/update",
            )

        # sqlite or other relational
        else:
            rows = [(x[0].split("-")[0], x[0], x[1]) for x in app.queue.list()]
            socketio.emit(
                "RELdatabase",
                {
                    "rows": rows,
                    "database": app.queue.database
                },
                namespace="/update",
            )

        socketio.sleep(QME_SOCKET_UPDATE_SECONDS)
示例#2
0
def rerun_row(json):
    """a request to re-run a particular task."""
    app.logger.debug("Received re-run request for %s", json.get("taskid"))
    taskid = json.get("taskid", "doesnotexist")
    was_rerun = app.queue.rerun(taskid) is not None
    socketio.emit(
        "reruncomplete",
        {
            "wasrerun": was_rerun,
            "taskid": taskid
        },
        namespace="/table/action",
    )
示例#3
0
def delete_row(json):
    """a request to delete a particular row"""
    app.logger.debug("Received deletion request for %s", json.get("taskid"))
    taskid = json.get("taskid", "doesnotexist")
    was_deleted = app.queue.clear(target=taskid, noprompt=True)
    socketio.emit(
        "deleterowcomplete",
        {
            "wasdeleted": was_deleted,
            "taskid": taskid
        },
        namespace="/table/action",
    )