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

Update rocoto_viewer to Python 3 #13

Open
WalterKolczynski-NOAA opened this issue Jun 22, 2021 · 0 comments · May be fixed by #16
Open

Update rocoto_viewer to Python 3 #13

WalterKolczynski-NOAA opened this issue Jun 22, 2021 · 0 comments · May be fixed by #16
Assignees
Labels
enhancement New feature or request

Comments

@WalterKolczynski-NOAA
Copy link
Collaborator

Python 2 has long been deprecated and rocoto_viewer should be updated to python 3.

@WalterKolczynski-NOAA WalterKolczynski-NOAA added the enhancement New feature or request label Jun 22, 2021
@WalterKolczynski-NOAA WalterKolczynski-NOAA self-assigned this Jun 22, 2021
WalterKolczynski-NOAA added a commit to WalterKolczynski-NOAA/CROW that referenced this issue Jul 7, 2021
The formatting for rocoto_viewer is updated to follow the PEP-8
standard. This mostly involves standardizing spacing, splitting
multi-import lines, and eliminating bare except keywords.

This is in preparation for updating to python3.

Refs: NOAA-EMC#13
WalterKolczynski-NOAA added a commit to WalterKolczynski-NOAA/CROW that referenced this issue Jul 12, 2021
The rocoto_viewer script is updated to python3. In addition to making
the necessary syntax updates like converting print statements into
print functions (adding parentheses), this requried removing the
dependency on produtils scripts (which are still in python2). This
change will also make the script more portable.

The largest chunk of changes to remove produtils revolves around
making system calls to run rocoto. These are replaced with a simple
wrapper function that calls subprocess, captures the output, and
returns it as a string. This also allows for the streamlining of
these portions of code.

A fallback is added in case lxml is not available. This will only
cause problems if lxml is not available and the user tries to read
a workflow that uses external entities, in which case a message
will be displayed notifying the user of the issue and providing
instructions on how to install lxml with pip. A similar existing
message for dateutil (used for UGCS's monthly increment) was
updated similarly.

Some incidental syntax updating and unused variable removal was
done as they were encountered, but a more complete cleaning of these
is still needed.

Refs: NOAA-EMC#13, NOAA-EMC#14
@WalterKolczynski-NOAA WalterKolczynski-NOAA linked a pull request Jul 12, 2021 that will close this issue
WalterKolczynski-NOAA added a commit to WalterKolczynski-NOAA/CROW that referenced this issue Jul 15, 2021
All strings still using the modulo (%) operator for substitution
are replaced with more readable f-strings instead.

Some remaining instances that were using functions from produtil
that were missed in the previous commit are updated to replace
those functions. Two functions for validating a POSIX shell string
are copied and updated from produtil for use here.

Some minor bugs and typos are resolved.

Replaced the former cPickle (which is not available for python3)
calls with pickle calls.

Fixed bugs in rocotocheck related to passing an int argument instead
of a string to syscall and not defining current_check_time.

Corrected issue with rocoto_viewer not immediately exiting when the
workflow cannot be parsed (usually because lxml could not be loaded).

Refs: NOAA-EMC#13, NOAA-EMC#14
WalterKolczynski-NOAA added a commit to WalterKolczynski-NOAA/CROW that referenced this issue Jul 15, 2021
Documentation blocks are added for all of the new functions added
to rocotoviewer. A more complete documentation of pre-existing
functions is still needed.

Refs: NOAA-EMC#13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant