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

Run granules sequentially in same working dir #26

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

Conversation

adybbroe
Copy link
Contributor

@adybbroe adybbroe commented May 22, 2023

  • Closes #xxxx
  • Tests added
  • Tests passed: Passes pytest cspp_runner
  • Passes flake8
  • Fully documented

Adam.Dybbroe added 8 commits May 5, 2023 11:11
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ctory was not created

Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…by using get and checking for None messages at time out of the for loop

Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ssages

Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…data handling in one function for now

Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@adybbroe adybbroe requested a review from gerritholl May 22, 2023 09:33
adybbroe and others added 3 commits May 22, 2023 11:38
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…b.com:adybbroe/pytroll-cspp-runner into run-granules-sequentially-in-same-working-dir
@adybbroe adybbroe marked this pull request as ready for review May 22, 2023 14:25
Comment on lines +4 to +8
# Copyright (c) 2023 Adam.Dybbroe

# Author(s):

# Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be pytroll-cssp-runner developers, and then the names of the authors can/should be in a separate AUTHORS file.

Copy link
Collaborator

@gerritholl gerritholl left a comment

Choose a reason for hiding this comment

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

Lots of good work here. I see you continued refactoring and improved the overall code base. However, that makes it difficult to see what is actually being changed. My comments are on the details, but I'm missing the overall picture. It's also a bit tricky to see what code was removed and what code was moved + changed.

Can you please document the PR? I mean the PR description here on GitHub, which is currently empty. The title does not to justice to the refactoring/rewriting carried out in this PR. It would be helpful if you could edit the title and description of the PR and summarise functional changes, refactoring changes, and any possible backward-compatibility changes.

Comment on lines +1 to +3
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Copy link
Collaborator

Choose a reason for hiding this comment

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

These lines are not needed.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2023 Pytroll Developers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Copyright (c) 2023 Pytroll Developers
# Copyright (c) 2023 pytroll-cspp-runner Developers


_NPP_SDRPROC_LOG_FILE = os.environ.get('NPP_SDRPROC_LOG_FILE', None)

LOG = logging.getLogger(__name__)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a constant, so logger would be a better choice as a variable name.

LOG = logging.getLogger(__name__)


class CSPPAncillaryDataUpdater():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
class CSPPAncillaryDataUpdater():
class CSPPAncillaryDataUpdater:

def initalize_working_dir(self):
"""Check and set the CSPP working directory."""
_check_environment("CSPP_WORKDIR")
self.cspp_workdir = os.environ.get("CSPP_WORKDIR", '')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self.cspp_workdir = os.environ.get("CSPP_WORKDIR", '')
self.cspp_workdir = os.environ["CSPP_WORKDIR"]

you're already enforcing its existence in the line above, so no need to guard and provide a default value that would anyway lead to failure in the following line

Comment on lines 257 to 262
# self.pool.apply_async(self.spawn_cspp, [keeper],
# {"publisher": publisher,
# "viirs_sdr_call": viirs_sdr_call,
# "viirs_sdr_options": viirs_sdr_options,
# "granule_time_tolerance": granule_time_tolerance
# }))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# self.pool.apply_async(self.spawn_cspp, [keeper],
# {"publisher": publisher,
# "viirs_sdr_call": viirs_sdr_call,
# "viirs_sdr_options": viirs_sdr_options,
# "granule_time_tolerance": granule_time_tolerance
# }))


ncpus_available = multiprocessing.cpu_count()
LOG.info("Number of CPUs available = " + str(ncpus_available))
LOG.info("Will use %d CPUs when running CSPP instances" % ncpus)
viirs_proc = ViirsSdrProcessor(ncpus, level1_home)
LOG.info("Will use %s CPUs when running CSPP instances" % str(ncpus))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Detail, but why this change? Are we not sure ncpus is an int?

Comment on lines +1 to +3
#!/usr/bin/env python
# -*- coding: utf-8 -*-

Copy link
Collaborator

Choose a reason for hiding this comment

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

This part is redundant.

Comment on lines +48 to +54
# @pytest.fixture
# def fake_empty_viirs_sdr_files_nine_seconds_deviation(tmp_path):
# """Write fake empty viirs sdr files."""
# starttime = datetime.datetime(2023, 5, 10, 14, 30, 53, 800000) + datetime.timedelta(seconds=9)
# return create_full_sdr_list_from_time(tmp_path, starttime)


Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# @pytest.fixture
# def fake_empty_viirs_sdr_files_nine_seconds_deviation(tmp_path):
# """Write fake empty viirs sdr files."""
# starttime = datetime.datetime(2023, 5, 10, 14, 30, 53, 800000) + datetime.timedelta(seconds=9)
# return create_full_sdr_list_from_time(tmp_path, starttime)

@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2013 - 2022 pytroll-cspp-runner developers
# Copyright (c) 2013 - 2023 Pytroll Developers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be pytroll-cspp-runner still?

Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Merging #26 (9de13f7) into main (6f22cca) will increase coverage by 3.17%.
The diff coverage is 95.20%.

❗ Current head 9de13f7 differs from pull request most recent head 25f75d2. Consider uploading reports for the commit 25f75d2 to get more accurate results

@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
+ Coverage   78.59%   81.77%   +3.17%     
==========================================
  Files          12       14       +2     
  Lines         995     1196     +201     
==========================================
+ Hits          782      978     +196     
- Misses        213      218       +5     
Flag Coverage Δ
unittests 81.77% <95.20%> (+3.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cspp_runner/tests/test_viirs_dr_runner.py 100.00% <ø> (ø)
cspp_runner/viirs_dr_runner.py 96.61% <ø> (-0.06%) ⬇️
cspp_runner/runner.py 85.66% <88.18%> (+0.68%) ⬆️
cspp_runner/cspp_utils.py 93.93% <93.93%> (ø)
cspp_runner/tests/test_runner.py 98.00% <95.89%> (-0.98%) ⬇️
cspp_runner/post_cspp.py 69.76% <96.42%> (+1.16%) ⬆️
cspp_runner/tests/conftest.py 100.00% <100.00%> (ø)
cspp_runner/tests/test_post_cspp.py 100.00% <100.00%> (ø)
cspp_runner/tests/test_utils.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Adam.Dybbroe added 5 commits May 30, 2023 12:32
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants