def _task_ms(task: Task) -> (str, str): try: task.resolve() _, _m = task.get_valid_key('master') if task.kind == 'cluster': _, _s = task.get_valid_key('slave') else: _s = None return _m, _s except RuntimeError as e: log.debug(str(e)) return None, None
def resolve_recipe(repo: Repo, task: Task, roi_id): try: task.resolve() _id, _roi = resolve_roi(roi_id, repo) r = TaskRecipe(task=task) f = r.get_ai_recipe_name(_roi['name']) if not os.path.isfile(f): raise RuntimeError(f"task recipe file {f} not found") log.info(f'recipe resolved via task: {f}') return f except AssertionError as e: raise click.UsageError(f'Task is invalid, reason: {e}') except RuntimeError as e: raise click.UsageError(str(e))