Skip to content

Commit

Permalink
Update dataset_validator.lua (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
kesarwam authored Dec 16, 2024
1 parent 749488f commit a26c9ae
Showing 1 changed file with 14 additions and 5 deletions.
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

0 comments on commit a26c9ae

Please sign in to comment.