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

fix return code for asn_from_list and skycell_asn, remove unused scripts, cleanup skycell_asn #1538

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Nov 25, 2024

This PR fixes the return code for asn_from_list and skycell_asn when they succeed (see #1535).

Which sorting out that fix I saw that:

  • "schema_editor" and "schemadoc" are registered scripts that do not exist. This PR removes their registration from pyproject.toml
  • The python function (not method) "skycell_asn" takes 1 argument "self". This PR updates the function signature to follow conventions of a non-method function. Further improvements are likely called for if this is expected to be part of the public API (it is mentioned in the documentation).

I left a number of in-line comments with some important ones about unused command line arguments for "skycell_asn" (which are not modified in this PR).

Closes #1535

Regtests running at: https://github.com/spacetelescope/RegressionTests/actions/runs/12018368084

Tasks

  • request a review from someone specific, to avoid making the maintainers review every PR
  • add a build milestone, i.e. 24Q4_B15 (use the latest build if not sure)
  • Does this PR change user-facing code / API? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • update or add relevant tests
    • update relevant docstrings and / or docs/ page
    • start a regression test and include a link to the running job (click here for instructions)
      • Do truth files need to be updated ("okified")?
        • after the reviewer has approved these changes, run okify_regtests to update the truth files
  • if a JIRA ticket exists, make sure it is resolved properly
news fragment change types...
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change
  • changes/<PR#>.docs.rst
  • changes/<PR#>.stpipe.rst
  • changes/<PR#>.associations.rst
  • changes/<PR#>.scripts.rst
  • changes/<PR#>.mosaic_pipeline.rst
  • changes/<PR#>.patch_match.rst

steps

  • changes/<PR#>.dq_init.rst
  • changes/<PR#>.saturation.rst
  • changes/<PR#>.refpix.rst
  • changes/<PR#>.linearity.rst
  • changes/<PR#>.dark_current.rst
  • changes/<PR#>.jump_detection.rst
  • changes/<PR#>.ramp_fitting.rst
  • changes/<PR#>.assign_wcs.rst
  • changes/<PR#>.flatfield.rst
  • changes/<PR#>.photom.rst
  • changes/<PR#>.flux.rst
  • changes/<PR#>.source_detection.rst
  • changes/<PR#>.tweakreg.rst
  • changes/<PR#>.skymatch.rst
  • changes/<PR#>.outlier_detection.rst
  • changes/<PR#>.resample.rst
  • changes/<PR#>.source_catalog.rst

@github-actions github-actions bot added dependencies Pull requests that update a dependency file associations labels Nov 25, 2024
Comment on lines -92 to -93
schema_editor = "romancal.scripts.schema_editor:main"
schemadoc = "romancal.scripts.schemadoc:main"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Neither of these exist and attempting to run schema_editor or schemadoc after installing romancal produces an error.

@github-actions github-actions bot added documentation Improvements or additions to documentation testing labels Nov 25, 2024
@@ -43,7 +43,7 @@ def asn_from_list(items, rule=DMS_ELPP_Base, **kwargs):
return asn


class Main:
def _cli(args=None):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Including a class as a script in pyproject.toml as is done on main:

asn_from_list = "romancal.associations.asn_from_list:Main"

results in an installed script containing the following line:

sys.exit(Main())

This is problematic because Main() is "truthy" resulting in the script returning 1 on success. By switching this to a function (with no return value) the script becomes:

sys.exit(main())

and the no return value (None) is "falsey" leading to a return code of 0 (success) when the script succeeds.

@@ -20,11 +20,11 @@
logger.setLevel("INFO")


def skycell_asn(self):
"""Create the associaton from the list"""
def skycell_asn(filelist, output_file_root, product_type, release_product):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I broke apart the def skycell_asn(self) function definition here. A docstring improvement would also be worth doing as this is a documented function. I did not make major changes in this PR because:

  1. the splitting of self is already an improvement
  2. I'm not sure what are the desired descriptions of these variables

A code suggestion for the docstring is appreciated.

help="The release product when creating the association",
)

parser.add_argument(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is unused both on main and with this PR.

"The rule to base the association structure on." ' Default: "%(default)s"'
),
)
parser.add_argument(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is unused both on main and with this PR.

help="Root string for file to write association to",
)

parser.add_argument(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is unused both on main and with this PR.

@braingram braingram changed the title fix return code for asn_from_list and skycell_asn, remove unused scripts fix return code for asn_from_list and skycell_asn, remove unused scripts, cleanup skycell_asn Nov 25, 2024
@braingram braingram marked this pull request as ready for review November 25, 2024 20:42
@braingram braingram requested a review from a team as a code owner November 25, 2024 20:42
@braingram
Copy link
Collaborator Author

braingram commented Nov 25, 2024

oldestdeps failure is addressed in #1539

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 76.19048% with 10 lines in your changes missing coverage. Please review.

Project coverage is 76.67%. Comparing base (bee71ba) to head (c4dc053).

Files with missing lines Patch % Lines
romancal/associations/skycell_asn.py 61.90% 8 Missing ⚠️
romancal/associations/asn_from_list.py 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1538      +/-   ##
==========================================
- Coverage   76.68%   76.67%   -0.01%     
==========================================
  Files         120      120              
  Lines        7831     7829       -2     
==========================================
- Hits         6005     6003       -2     
  Misses       1826     1826              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
associations dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation regression_testing testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asn_from_list has non 0 exit code on apparent success
1 participant