sul-dlss / common-accessioning

Suite of robots that handle the tasks of accessioning digital objects
Other
2 stars 1 forks source link

Ouput folder not always deleted by ocr cleanup class/robot #1315

Closed peetucket closed 3 months ago

peetucket commented 3 months ago

Seems reproducible, not sure why it is happening. Possibly odd mountiung issues/timing.

  1. Run integration test.
  2. It succeeds.
  3. Look at log and see that the logging indicates the output folder was deleted. No errors.
  4. Go to the file system, it's still there.
  5. Try and delete it again, and it works.

e.g. After integration test passes on the console, look at logs:

I, [2024-06-24T13:10:55.744967 #3137688]  INFO -- : Removing empty ABBYY input directory: /abbyy/INPUT/zz689fz1396
I, [2024-06-24T13:10:55.746523 #3137688]  INFO -- : Removing ABBYY output directory: /abbyy/OUTPUT/zz689fz1396
I, [2024-06-24T13:10:55.749515 #3137688]  INFO -- : Removing XML Ticket File: /abbyy/INPUT/zz689fz1396.xml
I, [2024-06-24T13:10:55.755287 #3137688]  INFO -- : Removing XML Result File: /abbyy/RESULTXML/zz689fz1396.xml.result.

Then go to the console:

dir='/abbyy/OUTPUT/zz689fz1396'
Dir.exist?(dir)
=> true
FileUtils.rm_rf(dir)
=> ["/abbyy/OUTPUT/zz689fz1396"]
Dir.exist?(dir)
=> false
peetucket commented 3 months ago

Looks like maybe there initially could be an issue deleting the output folder (why? don't know), but it is being swallowed by .rm_rf: https://github.com/ruby/fileutils/issues/57

Not sure what we would do if there was an attempt and it errored...if it happens often, putting the step in error is not great. Retrying is another possibility, but would be unfortunate to have to rely on.