Skip to content

Conversation

@Sweetdevil144
Copy link
Contributor

@Sweetdevil144 Sweetdevil144 commented Jul 18, 2024

Description

Following changes were performed :

  • Shift functions to check for missing files
  • Return from convert_input via a helper function
  • Refactor extra variables in run.meta.analysis
  • Update corresponding test files and add tests to ensure do_conversions isn't affected by current applied changes

Motivation and Context

The main motive for these changes is to simplify convert_input by trying to break some of its components and branch it to other functions.

This PR may fix a task within #3307

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Return from convert_input via a helper function

Update corresponding test files and add tests to ensure do_conversions isn't affected by current applied changes

Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Comment on lines 740 to 743
result_sizes <- checked.missing.files$result_sizes;
outlist <- checked.missing.files$outlist;
existing.input <- checked.missing.files$existing.input;
existing.dbfile <- checked.missing.files$existing.dbfile;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is their any other way to unwrap these variables in a single context line. For example, inheriting the above list and utilising the list$var syntax in-place. A lot of variable operations(assignment and reassignment) would consume extra memory in the heap. Should we also implement a Garbage Collection (gc()) or is it automatically applied in R ?

Copy link
Member

Choose a reason for hiding this comment

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

Rather than try to unwrap them in one line I'd consider whether they need to be assigned separate names at all -- e.g. can all places below that refer to result_sizes refer to checked.missing.files$result_sizes instead? If that's what you're suggesting by "utilising the list$var syntax in-place", then yes, I like that approach.

That said these objects are all very small and the runtime/memory overhead from reassignment will be negligible and R's reference-counting garbage collection will take care of the cleanup for us. Happily though, the same optimization gives (what I think is) a substantial improvement in code clarity, so I endorse it on those grounds.

Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
Signed-off-by: Abhinav Pandey <abhinav.pandey.met22@itbhu.ac.in>
@Sweetdevil144

This comment was marked as outdated.

@Sweetdevil144 Sweetdevil144 requested a review from mdietze January 31, 2025 11:38
} else {
PEcAn.logger::logger.warn("Input was not added to the database")
if(write) {
add_entries_result <- return (update_ensemble_writes(result, con, start_date,
Copy link
Contributor

Choose a reason for hiding this comment

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

add_entries_result <- update_ensemble_writes( result, con, start_date, end_date, overwrite, insert.new.file, input.args, machine, mimetype, formatname )
return(add_entries_result)

The return values assigned here to a variable likely is a bug , this patch might fix this up .

@infotroph infotroph enabled auto-merge October 16, 2025 08:05
@infotroph infotroph added this pull request to the merge queue Oct 16, 2025
Merged via the queue into PecanProject:develop with commit 99a0ec9 Oct 16, 2025
19 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants