Пример #1
0
def _active_projects():
    """Get active projects from the server.

    If there is a problem of any kind (exception, empty
    list) just return the single object to signify not set,
    otherwise prepend "not set to the list of projects". In
    this way we can populate the menu with at least one item
    and disable submit button if not set, rather than
    interrupting flow with an error.

    """
    notset = [{"id": "notset", "name": "- Not set -"}]
    api = api_client.ApiClient()

    response, response_code = api.make_request(
        uri_path='api/v1/projects/', verb="GET",
        raise_on_error=False, use_api_key=True)
    if response_code not in [200]:
        return notset

    projects = json.loads(response).get("data")
    if not projects:
        return notset

    projects = [{"id": project["id"], "name": project["name"]}
                for project in projects if project.get("status") == "active"]
    if not projects:
        return notset

    projects += notset
    return sorted(projects, key=lambda project: project["name"].lower())
Пример #2
0
    def __init__(self, args=None):
        logger.debug("Uploader.__init__")
        self.api_client = api_client.ApiClient()
        self.args = args or {}
        logger.debug("args: %s", self.args)

        self.location = self.args.get("location")
        self.project = self.args.get("project")
def get_task_log(job_id, task_id, first_line):

    api = conductor_api.ApiClient()

    uri = "get_log_file?job={job_id}&task={task_id}&num_lines%5B%5D={line_num}".format(
        job_id=job_id, task_id=task_id, line_num=first_line)
    response, response_code = api.make_request(uri_path=uri,
                                               verb="GET",
                                               raise_on_error=False,
                                               use_api_key=True)

    return response
def get_job_status(job_id, task_id=None):

    api = conductor_api.ApiClient()

    uri = "https://api.conductortech.com/api/v1/tasks?filter=jobLabel_eq_{},taskLabel_eq_{}".format(
        job_id, task_id)
    response, response_code = api.make_request(uri_path=uri,
                                               verb="GET",
                                               raise_on_error=False,
                                               use_api_key=True)

    return response
Пример #5
0
 def __init__(self, args):
     self.timeid = int(time.time())
     self.consume_args(args)
     self.validate_args()
     self.api_client = api_client.ApiClient()
Пример #6
0
 def __init__(self, *args, **kwargs):
     worker.ThreadWorker.__init__(self, *args, **kwargs)
     self.chunk_size = 1048576  # 1M
     self.report_size = 10485760  # 10M
     self.api_client = api_client.ApiClient()
Пример #7
0
 def __init__(self, *args, **kwargs):
     worker.ThreadWorker.__init__(self, *args, **kwargs)
     self.api_client = api_client.ApiClient()
     self.project = kwargs.get('project')
Пример #8
0
 def __init__(self, metric_store=None):
     self.metric_store = metric_store
     self.api_helper = api_client.ApiClient()
     self.thread = None
     self.terminate = False
Пример #9
0
 def __init__(self, *args, **kwargs):
     super(UploadWorker, self).__init__(*args, **kwargs)
     self.chunk_size = 1048576  # 1M
     self.report_size = 10485760  # 10M
     self.api_client = api_client.ApiClient()
Пример #10
0
 def __init__(self, *args, **kwargs):
     super(HttpBatchWorker, self).__init__(*args, **kwargs)
     self.api_client = api_client.ApiClient()
     self.project = kwargs.get('project')