sot / starcheck

BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Save and return exit status at END #404

Closed jeanconn closed 1 year ago

jeanconn commented 1 year ago

Description

Save and regurgitate exit status at END

Fixes ska_testr run test which was implicitly checking exit status.

Interface impacts

Testing

Unit tests

Functional tests

I confirmed that the "nominal exit" code is now 0 instead of 9 and that simple errors for missing or not existing directories for products give non-zero status:


Using bad_pixel file /proj/sot/ska/jeanproj/git/starcheck/starcheck/data/ACABadPixels
Using acq_star_rdb file /proj/sot/ska/jeanproj/git/starcheck/starcheck/data/bad_acq_stars.rdb
Using gui_star_rdb file /proj/sot/ska/jeanproj/git/starcheck/starcheck/data/bad_gui_stars.rdb
Reading backstop file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/CR140_0101.backstop
Reading DOT file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/mps/mdMAY2019A.dot
Reading TLR file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/CR140_0101.tlr
Reading MM file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/mps/mmMAY2019A.sum
Reading process summary /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/mps/msMAY2019A.sum
Reading mech check file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/output/TEST_mechcheck.txt
Reading OR file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/mps/or/MAY2019_A.or
Reading FIDSEL file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/History/FIDSEL.txt
Reading Maneuver Error file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/output/MAY2019A_ManErr.txt
Getting dither state from kadi at 2019:140:00:57:00.000 
Reading DITHER file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/History/DITHER.txt
Reading RADMON file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/History/RADMON.txt
Read 258 ACA bad pixels from /proj/sot/ska/jeanproj/git/starcheck/starcheck/data/ACABadPixels
Read 46 bad AGASC IDs from /proj/sot/ska/jeanproj/git/starcheck/starcheck/data/agasc.bad
#####################################################################
# calc_ccd_temps run at Mon Jan  9 12:47:10 2023 by jeanconn
# Continuity run_start_time = 2023:009:17:47:09.830
# calc_ccd_temps version = 14.0.1.dev1+gcc6be07
# chandra_models version = 3.45
# kadi version = 7.2.0
#####################################################################

Using backstop file /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/oflsa/CR140_0101.backstop
Found 1277 backstop commands between 2019:140:00:57:00.000 and 2019:146:23:52:35.589
RLTT = 2019:140:00:57:00.000
sched_stop = 2019:146:23:52:35.589
Fetching telemetry between 2019:139:00:57:00.000 and 2019:140:00:57:00.000
Calculating ACA thermal model
Propagation initial time and ACA: 2019:140:00:45:58.816 -9.50
Making temperature check plots
Writing plot file sctest/ccd_temperature.png
Checking star catalog for obsid 48165
Checking star catalog for obsid 48164
Wrote HTML report to sctest.html
Wrote text report to sctest.txt
0
(ska3-flight-2022.13rc0) jeanconn-fido> ./sandbox_starcheck -dir NOT_DIRECTORY -out sctest -max_obsids 2; echo $?
ERROR: No backstop file matching NOT_DIRECTORY/*.backstop

 at ./starcheck/src/starcheck.pl line 39.
    main::__ANON__("\x{a}") called at ./starcheck/src/starcheck.pl line 1137
    main::get_file("NOT_DIRECTORY/*.backstop", "backstop", "required") called at ./starcheck/src/starcheck.pl line 144
2
(ska3-flight-2022.13rc0) jeanconn-fido> ./sandbox_starcheck -dir /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019/ -out sctest -max_obsids 2; echo $?
ERROR: No backstop file matching /proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019//*.backstop

 at ./starcheck/src/starcheck.pl line 39.
    main::__ANON__("\x{a}") called at ./starcheck/src/starcheck.pl line 1137
    main::get_file("/proj/sot/ska/data/ska_testr/test_loads/2019/MAY2019//*.backstop", "backstop", "required") called at ./starcheck/src/starcheck.pl line 144
255
(ska3-flight-2022.13rc0) jeanconn-fido> 
javierggt commented 1 year ago

This works for me.

javierggt commented 1 year ago

and while you are at it, can you fix the indentation in that block? 😄

jeanconn commented 1 year ago

What's our indentation standard for perl anyway? I thought this looked OK actually.

javierggt commented 1 year ago

I don't know what are your coding standards for perl, but indentation is always a good idea. The main idea is that the indentation should tell you right away what is the nesting level. This is true even in languages that use brackets to denote scope.

In this case, I was stumped when reading the code and had to go line by line to match the brackets. This is a small block so it does not matter much, but still...

jeanconn commented 1 year ago

You've lost me. I thought END block code should be indented, so it is, and each block that is an if statement is also indented. But it looks like some if it is tabs instead of spaces?

jeanconn commented 1 year ago

I'll fix the tabs instead of spaces.

javierggt commented 1 year ago

ah, I see, it's a mixture of tabs and spaces. That should be forbidden in any coding standard 😉

So, whatever...

jeanconn commented 1 year ago

For "indentation standard" I really meant "what should we have for vscode and for perltidy to get something that displays ok". For perl, I was still sometimes opening this up in emacs which I think is happily using a mix of tabs and spaces that did not work for you. Editing it with "default" vscode" seems to have also left a mix of tabs and spaces but is now displaying them differently? I have stopped caring.

javierggt commented 1 year ago

I assume you are waiting for @taldcroft but it seems ok to me.

jeanconn commented 1 year ago

Yes, it would be good to have a review, but I just requested one from you which I think would be fine for this radical change.

jeanconn commented 1 year ago

🤣

taldcroft commented 1 year ago

Agreed w/ @javierggt that we should apply some formatting standards to starcheck, and ... https://github.com/sot/starcheck/pull/405