def get_all_organizationTask(trace_id): pm_logger = common_utils.begin_logger(trace_id, __name__, inspect.currentframe()) exclusiveStartKey = None organizationTasks = [] limit = 10 while True: try: result = DB_utils.scan(trace_id, Tables.PM_ORGANIZATION_TASKS, limit, exclusiveStartKey) organizationTasks.extend(result['Items']) if (common_utils.check_key('LastEvaluatedKey', result)): exclusiveStartKey = result['LastEvaluatedKey'] else: break time.sleep(1) except PmError as e: break return common_utils.response(organizationTasks, pm_logger)
def get_all_projects(trace_id): pm_logger = common_utils.begin_logger(trace_id, __name__, inspect.currentframe()) exclusiveStartKey = None projects = [] limit = int(common_utils.get_environ("NUM_OF_PROJECT_ITEMS_PER_1TIME")) segment = 0 while True: try: result = DB_utils.scan(trace_id, Tables.PM_PROJECTS, limit, exclusiveStartKey) projects.extend(result['Items']) if (common_utils.check_key('LastEvaluatedKey', result)): exclusiveStartKey = result['LastEvaluatedKey'] else: break segment += 1 time.sleep(1) except PmError as e: pm_logger.warning("プロジェクト情報取得に失敗しました。: 取得回数=%s、一度に取得する件数=%s", segment, limit) break return common_utils.response(projects, pm_logger), segment