def create_workload():
    """
    An interface to create a new workload and return a directory
    for the client to transfer data to and the workload id as is in the 
    database.
    """
    if request.method == "POST":
        username = request.form["username"]
        secret_key = ""
        access_key = ""
        key_pair = ""
        print "Request from %s" % username
        if "access_key" in request.form:
            access_key = request.form["access_key"]
            secret_key = request.form["secret_key"]
            key_pair = request.form["key_pair"]
        # Get the user id from the database
        res = {}
        try:

            db_manager = DBManager()
            user_id = db_manager.get_user_id(username, access_key, secret_key, key_pair)
            # Now create a new workload
            workload_id = db_manager.create_new_workload(user_id)
            workload_dir = create_workload_dir(workload_id)

            # Update the database to reflect the working dir being there
            db_manager.update_workload_dir(workload_id, workload_dir)

            res = {"workload_id": workload_id, "workload_dir": workload_dir}
        except Exception, e:
            print "Error: %s" % e
            raise e
        return jsonify(res)