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

Release of 4.0.8 #166

Merged
merged 44 commits into from
Jun 14, 2023
Merged

Release of 4.0.8 #166

merged 44 commits into from
Jun 14, 2023

Conversation

@netlify
Copy link

netlify bot commented May 3, 2023

Deploy Preview for pyra-4-documentation ready!

Name Link
🔨 Latest commit dd29bae
🔍 Latest deploy log https://app.netlify.com/sites/pyra-4-documentation/deploys/64898428e404990008e7add0
😎 Deploy Preview https://deploy-preview-166--pyra-4-documentation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@dostuffthatmatters
Copy link
Member Author

@patrickjaigner do you want to have a look at it before we try to run it on system ma?

@dostuffthatmatters
Copy link
Member Author

Had to rebase it onto the main branch, that is why I force-pushed.

try:
_run_pyra_core_lock.acquire()
_run_pyra_core_lock.release()
except filelock.Timeout:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the best way to do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so.

run_pyra_core.py will acquire that lock before the mainloop starts and frees it when the program finishes or crashes:

pyra/run_pyra_core.py

Lines 14 to 22 in 52eb662

if __name__ == "__main__":
try:
_run_pyra_core_lock.acquire()
try:
main.run()
finally:
_run_pyra_core_lock.release()
except filelock.Timeout:
print("Aborting start: core process is already running")

When the pyra-cli start command cannot acquire the Lock, some Pyra Core process must be running.

The other option would be to cycle through all running processes (like the is-running command), but I think that is more work to implement because there are different cases.

self.config["general"]["min_sun_elevation"] - 1
) * utils.Astronomy.units.deg

if current_sun_elevation is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why could you remove this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

I could remove this because the new Astronomy class implementation will throw an exception when the current sun elevation is not a float. I return float(output from skyfield library):

current_position = earth + skyfield.api.wgs84.latlon(
latitude_degrees=lat,
longitude_degrees=lon,
elevation_m=alt,
)
sun_pos = current_position.at(current_time).observe(sun).apparent()
altitude, _, _ = sun_pos.altaz()
return float(altitude.degrees)

Screenshot 2023-05-08 at 20 46 14

Copy link
Member Author

Choose a reason for hiding this comment

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

There is also a new test that draw random datetimes from each year between 2020 and 2050 and checks if the Astronomy class can generate an elevation for that: https://github.com/tum-esm/pyra/blob/integration-4.0.8/tests/utils/test_astronomy.py

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you let me know why you changed the Docstrings? Now they are different lengths and also every shorter than the rest of the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! The wide comment blocks are hard to read on small monitors. I often work with two files open next to each other:

Screenshot 2023-05-08 at 20 42 06

But when the lines of the doc strings are very long, it is super annoying when every lines wraps to a new line:

Screenshot 2023-05-08 at 20 41 48

On big monitors, that is not an issue but whenever using two files or doing any diffing stuff on a tiny one, it bothers a lot.

Would you like to revert it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't realize this, but sure let's keep the changes.

# logger.debug(f'Successfully closed OPUS instance "{p}"')
# except Exception as e:
# logger.warning(f"Failed to close OPUS: {e}")

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should not keep in in the code, but move it to the issue.

Copy link
Contributor

@patrickjaigner patrickjaigner left a comment

Choose a reason for hiding this comment

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

I finished reading through the changes. There is a lot of good refactoring done. I also added some comments for lines where I needed clarification on why changes were made.

Overall we should think about how easy and accessible the tum-esm-utils library is. Will people easily find the API description (a quick Google search didn't give me the correct result) or will it confuse people as relevant code is now moved to a different repository? I'm unsure if I like it for Pyra, as it will make it harder for people to add additional things to functions or make changes. What do you think?

@dostuffthatmatters
Copy link
Member Author

dostuffthatmatters commented May 8, 2023

I finished reading through the changes. There is a lot of good refactoring done. I also added some comments for lines where I needed clarification on why changes were made.

Thank you for the review 👍

Overall we should think about how easy and accessible the tum-esm-utils library is. Will people easily find the API description (a quick Google search didn't give me the correct result) or will it confuse people as relevant code is now moved to a different repository? I'm unsure if I like it for Pyra, as it will make it harder for people to add additional things to functions or make changes. What do you think?

Good question! The index of DuckDuckGo is great:

Screenshot 2023-05-08 at 21 52 39

But the index of Google is terrible 😅:

Screenshot 2023-05-08 at 21 54 01

(Both searches were done on a browser with no local traces of me)


You are right about making changes harder by outsourcing thinks. Three things I would do:

  • We can add a link to the utils repository to every project's README that uses it, this way, the page rank will improve and Google should have it soon too.

  • If we adhere to only outsource the things that are very general (run_shell_command, merge_dicts) and strictly type and document all functions, I think this is an improvement on the complexity of all projects that use the library. The current set of functions is already well documented I think, and most custom utility folder has worse testing and documentation than this library:
    Screenshot 2023-05-08 at 22 00 43

  • We can add a link to the repository, the website and the PyPI page to the doc string of the module, then it is quicker to find documentation about it:
    Screenshot 2023-05-08 at 22 00 14

@dostuffthatmatters
Copy link
Member Author

dostuffthatmatters commented May 8, 2023

EDIT: Regarding the documentation of the utility library, from 1.5.2 (https://pypi.org/project/tum-esm-utils/1.5.2/), the module doc strings will include more information:

demo.mp4

@patrickjaigner
Copy link
Contributor

@dostuffthatmatters Finished my review. All points clarified, thank you.

@dostuffthatmatters dostuffthatmatters marked this pull request as ready for review May 23, 2023 11:04
@dostuffthatmatters
Copy link
Member Author

@patrickjaigner this is running well on the integration station. Do you approve the release?

@patrickjaigner
Copy link
Contributor

@dostuffthatmatters Sounds good. Let's confirm a 7 days stable run of the release. Other than that I agree that 4.0.8 is ready to go.

improve autoexposure function resilience
run autoexposure function less frequent, update function comment
update API reference
raise exception, when mean colors are not increasing with exposure time
improve typing inside autoexposure function to resolve mypy issues
@dostuffthatmatters dostuffthatmatters merged commit dd29bae into main Jun 14, 2023
@dostuffthatmatters dostuffthatmatters deleted the integration-4.0.8 branch July 8, 2023 09:43
@dostuffthatmatters dostuffthatmatters changed the title Integration 4.0.8 Release of 4.0.8 Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment