Пример #1
0
def create_task():
    project_name = request.params.project_name
    username = request.params.username

    if not project_name or not username:
        # error
        return "Error"

    new_task = MergeTask(project_name, username)
    tasks.put(new_task)

    return "OK\n"
Пример #2
0
def rsync_request():
    """ Create a rsync task and wait until the DELETE http method is
    called on the same url to continue.
    """

    project_name = request.params.project_name
    username = request.params.username
    server_host = request.params.server_host

    # Create the rsync task.
    rsync_task = RsyncTask()
    tasks.put(rsync_task)

    # Associate a uuid to the rsync task and store it into rsync_tasks
    # dict.
    req_id = str(uuid.uuid4())
    rsync_tasks[req_id] = rsync_task

    # Return all the necessary information to the baboon client.
    ret = {"req_id": req_id, "remote_dir": "root@%s:/tmp/%s/%s/" % (server_host, project_name, username)}

    # Return the dict
    return ret
Пример #3
0
def signal_handler(signal, frame):
    print 'Bye !'
    tasks.put(EndTask())
    e.join()
    sys.exit(0)