コード例 #1
0
    def update(self, status):
        """
        Updates the job's status on the server that created it.

        :param dict status: The new status of the job
        """
        self.status = status
        body = hoplite_dumps({
            "api_key": self._api_key,
            "status": status
        })
        url = self._daemon_addr + '/jobs/{0}'.format(self._uuid)
        headers = {'content-type': 'application/json'}
        r = requests.put(url, data=body, headers=headers)
        if r.status_code == 404:
            raise JobDoesNotExistError
コード例 #2
0
ファイル: test_remote_job_manager.py プロジェクト: ni/hoplite
def get_running_jobs(url, request):
    if request.method == 'GET':
        return response(200, hoplite_dumps({"jobs": [{"uuid": 111}]}))
コード例 #3
0
 def _json_data(self, kwargs, csrf_enabled=True):
     if 'data' in kwargs:
         kwargs['data'] = hoplite_dumps(kwargs['data'])
     if not kwargs.get('content_type'):
         kwargs['content_type'] = 'application/json'
     return kwargs
コード例 #4
0
ファイル: helpers.py プロジェクト: ni/hoplite
 def _json_data(self, kwargs):
     if 'data' in kwargs:
         kwargs['data'] = hoplite_dumps(kwargs['data'])
     if not kwargs.get('headers', None):
         kwargs['headers'] = {'Content-type': 'application/json'}
     return kwargs
コード例 #5
0
ファイル: utils.py プロジェクト: ni/hoplite
 def _json_data(self, kwargs, csrf_enabled=True):
     if 'data' in kwargs:
         kwargs['data'] = hoplite_dumps(kwargs['data'])
     if not kwargs.get('content_type'):
         kwargs['content_type'] = 'application/json'
     return kwargs
コード例 #6
0
def kill_job(url, request):
    if request.method == 'PUT':
        return response(200, hoplite_dumps(killed_dict),
                        {'content-type': 'application/json'})
コード例 #7
0
def get_specific_job_named_something(url, request):
    return response(200, hoplite_dumps(job_dict_name_something),
                    {'content-type': 'application/json'})
コード例 #8
0
def post_jobs(url, request):
    if request.method == 'POST' and request.headers[
            'Content-type'] == 'application/json':
        return response(200, hoplite_dumps(job_dict_name_something),
                        {'content-type': 'application/json'})
コード例 #9
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def get_specific_job(url, request):
    return response(200, hoplite_dumps(job_dict), {'content-type': 'application/json'})
コード例 #10
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def get_with_exception(url, request):
    return response(200, hoplite_dumps(excepted_job), {'content-type': 'application/json'})
コード例 #11
0
def delete(url, request):
    if request.method == 'DELETE' and _request_has_json_content_type(request)\
            and request.body == hoplite_dumps(DATA):
        return response(200)
コード例 #12
0
def patch(url, request):
    if request.method == 'PATCH' and _request_has_json_content_type(request)\
            and request.body == hoplite_dumps(DATA):
        return response(200)
コード例 #13
0
def post(url, request):
    print request.body
    if request.method == 'POST' and _request_has_json_content_type(request)\
            and request.body == hoplite_dumps(DATA):
        return response(200)
コード例 #14
0
def get_running_jobs(url, request):
    if request.method == 'GET':
        return response(200, hoplite_dumps({"jobs": [{"uuid": 111}]}))
コード例 #15
0
def get_with_exception(url, request):
    return response(200, hoplite_dumps(excepted_job),
                    {'content-type': 'application/json'})
コード例 #16
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def post_jobs(url, request):
    if request.method == 'POST' and request.headers['Content-type'] == 'application/json':
        return response(200, hoplite_dumps(job_dict_name_something), {'content-type': 'application/json'})
コード例 #17
0
def get_specific_job(url, request):
    return response(200, hoplite_dumps(job_dict),
                    {'content-type': 'application/json'})
コード例 #18
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def post_jobs_400(url, request):
    if request.method == 'POST' and request.headers['Content-type'] == 'application/json':
        return response(400, hoplite_dumps({"error": "Job not found"}), {'content-type': 'application/json'})
コード例 #19
0
def post_jobs_400(url, request):
    if request.method == 'POST' and request.headers[
            'Content-type'] == 'application/json':
        return response(400, hoplite_dumps({"error": "Job not found"}),
                        {'content-type': 'application/json'})
コード例 #20
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def get_specific_job_named_something(url, request):
    return response(200, hoplite_dumps(job_dict_name_something), {'content-type': 'application/json'})
コード例 #21
0
def get_specific_job_running_false_finished_true(url, request):
    return response(200, hoplite_dumps(job_dict_2),
                    {'content-type': 'application/json'})
コード例 #22
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def get_specific_job_running_false_finished_true(url, request):
    return response(200,  hoplite_dumps(job_dict_2), {'content-type': 'application/json'})
コード例 #23
0
ファイル: helpers.py プロジェクト: tosobright/hoplite
 def _json_data(self, kwargs):
     if 'data' in kwargs:
         kwargs['data'] = hoplite_dumps(kwargs['data'])
     if not kwargs.get('headers', None):
         kwargs['headers'] = {'Content-type': 'application/json'}
     return kwargs
コード例 #24
0
ファイル: test_remote_job.py プロジェクト: ni/hoplite
def kill_job(url, request):
    if request.method == 'PUT':
        return response(200,  hoplite_dumps(killed_dict), {'content-type': 'application/json'})
コード例 #25
0
ファイル: helpers.py プロジェクト: ni/hoplite
def jsonify(*args, **kwargs):
    """
        jsonify that uses hoplite's serial encoder
    """
    return werkzeug.Response(
        hoplite_dumps(dict(*args, **kwargs)), mimetype='application/json')
コード例 #26
0
ファイル: helpers.py プロジェクト: tosobright/hoplite
def jsonify(*args, **kwargs):
    """
        jsonify that uses hoplite's serial encoder
    """
    return werkzeug.Response(hoplite_dumps(dict(*args, **kwargs)),
                             mimetype='application/json')