1 # Copyright 2016 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 from lcm.pub.utils.jobutil import JobUtil
17 from lcm.pub.utils.values import remove_none_key
18 from lcm.jobs.api_model import JobQueryResp, JobDescriptor, JobHistory
21 logger = logging.getLogger(__name__)
24 class GetJobInfoService(object):
25 def __init__(self, job_id, response_id=0):
27 self.response_id = response_id if response_id else 0
30 logger.debug("GetJobInfoService, job_id=%s, response_id=%s", self.job_id, self.response_id)
31 jobs = JobUtil.query_job_status(self.job_id, self.response_id)
33 job_query_resp = JobQueryResp(self.job_id)
34 return remove_none_key(job_query_resp.to_dict())
35 job_query_resp = JobQueryResp(
54 return remove_none_key(job_query_resp.to_dict())