Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed metadata validation lua script dataset_validator.lua #234

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions 00_notebooks/hooks/dataset_validator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ while has_more do
-- find nearest metadata file
while has_parent do
parsed = path.parse(current)

if not parsed.parent or parsed.parent == "" then
has_parent = false
break
current_descriptor = args.metadata_file_name
else
current_descriptor = path.join("/", parsed.parent, args.metadata_file_name)
end
current_descriptor = path.join("/", parsed.parent, args.metadata_file_name)

-- check if this descriptor has already been cached
if metadata_files[current_descriptor] then
-- cache hit
Expand All @@ -123,6 +125,11 @@ while has_more do
end
end

if not parsed.parent or parsed.parent == "" then
has_parent = false
break
end

current = parsed.parent
end

Expand All @@ -139,7 +146,9 @@ end

-- now let's review all the metadata files for this commit:
for metadata_filename, metadata_file in pairs(metadata_files) do
for _, field_descriptor in ipairs(args.fields) do
check_field(field_descriptor, metadata_file[field_descriptor.name], metadata_filename)
if metadata_file then
for _, field_descriptor in ipairs(args.fields) do
check_field(field_descriptor, metadata_file[field_descriptor.name], metadata_filename)
end
end
end