Skip to content

Create a tool for inspecting individual tron dynamodb items#1107

Open
CharlesPeacock wants to merge 5 commits into
masterfrom
TRON-2603_cpeacock_create_a_tool_for_inspecting_individual_tron_dynamodb_items
Open

Create a tool for inspecting individual tron dynamodb items#1107
CharlesPeacock wants to merge 5 commits into
masterfrom
TRON-2603_cpeacock_create_a_tool_for_inspecting_individual_tron_dynamodb_items

Conversation

@CharlesPeacock

@CharlesPeacock CharlesPeacock commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

This is a script made to check individual Tron DynamoDB items.

During DAR-2843, diagnosing for corrupted state required ad-hoc scripting, this reusable tool aims to help in future investigations.

It can also be useful for anyone working on dynamodb_state_store.py now that these states are no longer stored in plain text.

It handles multi-partition reconstruction, decompression and deserialization so that you no longer need to do it manually.

CharlesPeacock and others added 2 commits July 17, 2026 19:52
Updated comments for clarity and improved metadata print function description.
@CharlesPeacock CharlesPeacock self-assigned this Jul 20, 2026
@CharlesPeacock
CharlesPeacock requested a review from KaspariK July 20, 2026 21:48
@CharlesPeacock
CharlesPeacock marked this pull request as ready for review July 20, 2026 21:48
@CharlesPeacock
CharlesPeacock requested a review from a team as a code owner July 20, 2026 21:48
Comment thread tools/read_dynamodb_item.py Outdated
raw_json = reassemble_json(partitions)

if args.raw:
parsed = json.loads(raw_json)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--raw should not parse the decompressed payload. Using json.loads() will raise (or normalize, if there is somehow a duplicate key or something) malformed json before we inspect it. I think we'd want to write the raw_json directly

Comment thread tools/read_dynamodb_item.py Outdated
Checking a job's state:

AWS_PROFILE=devc python3 tools/read_dynamodb_item.py --table infrastage-tron-state --region us-west-1 --type job_state --name compute-i
nfra-test-service.test_partitions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably didn't mean to add this line break

Comment thread tools/read_dynamodb_item.py Outdated
def get_client(table_name: str, region: str):
retry_config = Config(retries={"max_attempts": 5, "mode": "standard"})
client = boto3.client("dynamodb", region_name=region, config=retry_config)
return client, table_name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns table_name unchanged. Instead, we can accept only region and return the client.

Comment thread tools/read_dynamodb_item.py Outdated
Comment on lines +150 to +159
parser.add_argument(
"--raw",
action="store_true",
help="Dump decompressed JSON without deserializing through Tron's from_json",
)
parser.add_argument(
"--metadata",
action="store_true",
help="Show only partition metadata (count, sizes) without the payload",
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a total nit, but --raw and --metadata can currently be provided together, with --metadata silently winning. If we wanted, we could use a mutually exclusive group to clarify this. Really not a big deal imo

…tually exclusive group to args metadata and raw -improve raw argument by printing out raw json
…_create_a_tool_for_inspecting_individual_tron_dynamodb_items

Update branch with new master changes
…ual_tron_dynamodb_items' of github.com:Yelp/Tron into TRON-2603_cpeacock_create_a_tool_for_inspecting_individual_tron_dynamodb_items

Update branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants