-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Run granules sequentially in same working dir #26
Conversation
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>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…b.com:adybbroe/pytroll-cspp-runner into run-granules-sequentially-in-same-working-dir
# Copyright (c) 2023 Adam.Dybbroe | ||
|
||
# Author(s): | ||
|
||
# Adam.Dybbroe <a000680@c21856.ad.smhi.se> |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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__) |
There was a problem hiding this comment.
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(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class CSPPAncillaryDataUpdater(): | |
class CSPPAncillaryDataUpdater: |
cspp_runner/cspp_utils.py
Outdated
def initalize_working_dir(self): | ||
"""Check and set the CSPP working directory.""" | ||
_check_environment("CSPP_WORKDIR") | ||
self.cspp_workdir = os.environ.get("CSPP_WORKDIR", '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
cspp_runner/runner.py
Outdated
# 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 | ||
# })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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)) |
There was a problem hiding this comment.
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?
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is redundant.
# @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) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# @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 |
There was a problem hiding this comment.
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 Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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>
pytest cspp_runner
flake8