adopt_pick.py

Created about 12 hours ago

attributes
source_pathreferences/auto-labeling/code_templates/adopt_pick.py
source_sha256943c2cd1d5139901c1c56576be2a924728ea50638d97fd920669b76468bf3adb
source_urlhttps://github.com/aws/agent-toolkit-for-aws/blob/903433d67cc4eeab334355620373f33a0c162dd4/skills/core-skills/aws-ai-ml/references/auto-labeling/code_templates/adopt_pick.py
supporting_skill_id40202
upstream_revision903433d67cc4eeab334355620373f33a0c162dd4
# Cell 0 [markdown]: The in-job search's pick
# # The in-job search's pick
#
# `adopt-job` copies the spec the in-job search picked into the project after your approval;
# `ship` checks that copy against the approval and writes it as the spec that ships. No job
# is submitted.
# Cell 1: Configuration
ACTION = "[ACTION]"            # adopt-job | ship
PROJECT_DIR = "[PROJECT_DIR]"  # the project directory
PICK = None                    # [PICK]: adopt-job: <out dir>/job/optimize/spec.md
APPROVAL = None                # [APPROVAL]: adopt-job: the approval entry's id in the run log
OUT = None                     # [OUT]: ship: <proj>/labeling_spec.md

import json
import sys

from sagemaker.core import Attribution, set_attribution

set_attribution(Attribution.SAGEMAKER_AGENT_PLUGIN)

from sagemaker.ai_registry.data_preparer.exceptions import DataPreparerOperatorError
from sagemaker.ai_registry.data_preparer.auto_labeling.operators.spec import adopt_job_pick, ship_adopted_spec

# Cell 2: Run the action
try:
    if ACTION == "adopt-job":
        out = adopt_job_pick(PROJECT_DIR, PICK, APPROVAL)
        print(json.dumps({"decision_entry": out["decision_entry"], "spec": out["spec"]}, indent=2))
    elif ACTION == "ship":
        print(json.dumps(ship_adopted_spec(PROJECT_DIR, OUT)))
    else:
        sys.exit(f"ACTION must be adopt-job or ship; got {ACTION!r}")
except DataPreparerOperatorError as e:
    sys.exit(str(e))

Children

No children yet.

Like how this is organised?

Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.