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

Python3 Rose suite run #2317

Merged
merged 14 commits into from
Jun 11, 2019
Merged

Conversation

wxtim
Copy link
Contributor

@wxtim wxtim commented Mar 19, 2019

fix: #2304
Current travis test failure exists in master

@matthewrmshin matthewrmshin added this to the next-feature-alpha milestone Mar 20, 2019
@matthewrmshin matthewrmshin added this to In progress in 2to3 via automation Mar 20, 2019
@wxtim wxtim force-pushed the i2304_rose-suite-run branch 2 times, most recently from 7a5cb45 to 7b4355b Compare March 22, 2019 10:55
@wxtim wxtim changed the title [WIP] Rose suite run working for local tests Rose suite run working for local tests Mar 22, 2019
Copy link
Member

@matthewrmshin matthewrmshin left a comment

Choose a reason for hiding this comment

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

First pass through my 👀 👓. Mostly OK. Some test files were symbolic links so one file could do several tests. You might have changed them to regular files, which is fine, but you may want to prune some of the logic for handling the multiple tests.

patch Outdated Show resolved Hide resolved
t/rose-ana/01-run-basic-v1.t Outdated Show resolved Hide resolved
Copy link
Contributor

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

I am still testing the functionality.

A few minor comments, including stylistic ones that do not have to be addressed in this PR (they will not block my approval) but I will register now, possibly to address later, since I have noticed them. An umbrella comment, there are (as you seem to be aware) a lot of instances of:

if isinstance(<VAR>, bytes):
    <VAR> = <VAR>.decode()
if isinstance(<VAR>, bytes):
    <VAR> = <VAR>.decode()

As per your comment @TODO fast fix in the Python3 conversion. Working > perfect) they are not ideal, but in fact I think if we have these cases whereby we need to test if a variable is bytes or not, we have not been careful enough in the encoding, & when we eventually get round to cleaning things up, we could easily end up changing most or all of the de- & en-coding calls. So if possible can we try to handle the change in processing of strings & bytes with no need to check types.

lib/python/rose/suite_run.py Show resolved Hide resolved
lib/python/rose/popen.py Outdated Show resolved Hide resolved
lib/python/rose/apps/rose_bunch.py Outdated Show resolved Hide resolved
lib/python/rose/apps/rose_ana_v1.py Outdated Show resolved Hide resolved
@wxtim wxtim force-pushed the i2304_rose-suite-run branch 2 times, most recently from 0a1bb23 to 0021192 Compare March 25, 2019 15:37
@wxtim wxtim moved this from In progress to Under Review in 2to3 Mar 26, 2019
@wxtim wxtim changed the title Rose suite run working for local tests Python3 Rose suite run Mar 27, 2019
@wxtim
Copy link
Contributor Author

wxtim commented Mar 27, 2019

This is failing on the same thing as master. :(

@wxtim wxtim mentioned this pull request Apr 1, 2019
@oliver-sanders
Copy link
Member

Note:

In #2310 the tutorial suite tests (t/docs/02-tutorial-suites.t) are re-instated but the rose suite-run tests are skipped.

@wxtim wxtim removed this from Under Review in 2to3 Apr 24, 2019
@wxtim wxtim force-pushed the i2304_rose-suite-run branch 3 times, most recently from 107a57c to a8cd9b1 Compare April 29, 2019 14:53
@matthewrmshin matthewrmshin added this to In progress in 2to3 via automation Apr 30, 2019
@matthewrmshin
Copy link
Member

Why are all your earlier changesets in pairs?

@oliver-sanders oliver-sanders removed the request for review from stevewardle May 9, 2019 15:55
@wxtim
Copy link
Contributor Author

wxtim commented May 10, 2019

Why are all your earlier changesets in pairs?

I have no idea. Weird, isn't it!


:default: Default

.. _documentation: https://docs.python.org/2.7/library/itertools.html
.. _documentation: https://docs.python.org/3.7/library/itertools.html
Copy link
Member

@oliver-sanders oliver-sanders Jun 3, 2019

Choose a reason for hiding this comment

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

Suggested change
.. _documentation: https://docs.python.org/3.7/library/itertools.html
.. _itertools documentation: https://docs.python.org/3/library/itertools.html

@oliver-sanders
Copy link
Member

Documentation test failure may be related to the latest Sphinx release. I would suggest ignoring this for now as the only docs change is fine.

@sadielbartholomew
Copy link
Contributor

sadielbartholomew commented Jun 3, 2019

Thanks for addressing that final point. The only Travis CI failure is also failing on master (with feasible origin given as above), so that can be considered as a pass for the code changes here.

Just running my local test battery on the final state & I expect that will pass, then we can merge. Great work!

Copy link
Contributor

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

In general, passes a "sanity check" but (sorry) there are a few more issues emerging from some functionality testing. They shouldn't take long to fix, however:

  1. Consistently for rose suite-run commands some lines towards the end of the STDOUT appear to have not been decoded properly, so for example the 'CYLC' ASCII letters get mangled:

    [INFO] delete: suite.rc
    [INFO] install: suite.rc
    [INFO] b'REGISTERED subsuite-app-domingo -> /home/h06/sbarth/cylc-run/subsuite-app-domingo\n'
    [INFO] chdir: log/
    [INFO] b"            ._.                                                       \n            | |                 The Cylc Suite Engine [8.0a0]         \n._____._. ._| |_____.           Copyright (C) 2008-2019 NIWA          \n| .___| | | | | .___|   & British Crown (Met Office) & Contributors.  \n| !___| !_! | | !___.  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n!_____!___. |_!_____!  This program comes with ABSOLUTELY NO WARRANTY.\n      .___! |              It is free software, you are welcome to    \n      !_____!             redistribute it under certain conditions;   \n\n*** listening on tcp://vld456.cmpd1.metoffice.gov.uk:43016/ ***\n\nTo view suite server program contact information:\n $ cylc get-suite-contact subsuite-app-domingo\n\nOther ways to see if the suite is still running:\n $ cylc scan -n 'subsuite-app-domingo' vld456.cmpd1.metoffice.gov.uk\n $ cylc ping -v --host=vld456.cmpd1.metoffice.gov.uk subsuite-app-domingo\n $ ps -opid,args 92618  # on vld456.cmpd1.metoffice.gov.uk\n\n"
    
  2. I get a repeated error from many of the test battery tests for the security auto-message which should just get ignored. Again it looks like decoding is not quite right (or present) somewhere:

     ssh -oBatchMode=yes -oConnectTimeout=10 -n xcel00 env\ ROSE_VERSION=2019.01.0-104-gf0d6583d\ CYLC_VERSION=8.0a0\ bash\ -l\ -c\ \'\"$0\"\ \"$@\"\'\ rose\ suite-run\ -vv\ -n\ rose-test-battery.40kEqx\ --new\ --run=run\ --remote=uuid=f11fb24a-a15c-487e-b23d-55147b393332,now-str=20190603T142808Z # return-code=126, stderr=
    [FAIL] b'  WARNING: This computer is provided for the processing of official\n  information. Unauthorised access may constitute a criminal\n  offence. By continuing to use this facility you agree to abide by\n  the Met Office Your Security Commitments. All activity on this\n  system is liable to monitoring.\n\n/opt/ukmo/supported/bin/rose: line 24: /home/d04/sbarth/rose/bin/rose: No such file or directory\n/opt/ukmo/supported/bin/rose: line 24: exec: /home/d04/sbarth/rose/bin/rose: cannot execute: No such file or directory\n'
    

@oliver-sanders
Copy link
Member

it looks like decoding is not quite right (or present) somewhere:

Looks like a subprocess call isn't getting wrapped with decode as desired but that it's output is then getting repred (because it appears as b'...').

@wxtim
Copy link
Contributor Author

wxtim commented Jun 3, 2019

it looks like decoding is not quite right (or present) somewhere:

Looks like a subprocess call isn't getting wrapped with decode as desired but that it's output is then getting repred (because it appears as b'...').

I've put an extra isinstance(message, bytes) into reporter.py. This should act as a catch all for any more of these.

@oliver-sanders
Copy link
Member

oliver-sanders commented Jun 4, 2019

Have tested rose suite-run, things seem to be working as expected.

I've just found some decode issues:

[edit] tested as fixed:

  • Stuff returned rose suite-run when invoked remotely via ssh.
  • lib/python/rose/suite_run.py#424 TypeError: a bytes-like object is required, not 'str'

@wxtim
Copy link
Contributor Author

wxtim commented Jun 4, 2019

I think that I've not done the python3 conversion as well as it could have been done, and that there should be a decode in rose.popen in method run for stderr and stdout. This will be safer in the long run because it will decode everything at source, but will require removal of a bunch of decodes put in elsewhere.

I have created issue #2344 to cover this, but it's not as much of a priority IMO as rose-packaging.

@wxtim wxtim changed the title Python3 Rose suite run [Sphinx Fail == Master Sphinx Fail] Python3 Rose suite run Jun 5, 2019
@oliver-sanders oliver-sanders mentioned this pull request Jun 5, 2019
t/rose-task-run/12-app-prune-integer.t Outdated Show resolved Hide resolved
@wxtim wxtim changed the title [Sphinx Fail == Master Sphinx Fail] Python3 Rose suite run Python3 Rose suite run [Sphinx Fail == Master Sphinx Fail] Jun 10, 2019
@wxtim wxtim changed the title Python3 Rose suite run [Sphinx Fail == Master Sphinx Fail] Python3 Rose suite run Jun 11, 2019
@sadielbartholomew
Copy link
Contributor

sadielbartholomew commented Jun 11, 2019

[Note: awaiting a final second review from myself before merging as the PR has changed greatly since @matthewrmshin's approval.]

Copy link
Contributor

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

Previous feedback addressed.

Passes a sanity check overall, though with the caveat that we are unable to properly evaluate the local test battery remote job tests (not run on Travis CI) due to the dependency on the newly-packaged cylc-flow.

Great! Another big step towards a Python 3 Rose 🌄.

@sadielbartholomew sadielbartholomew merged commit f0634cc into metomi:master Jun 11, 2019
2to3 automation moved this from Under Review to Done Jun 11, 2019
@matthewrmshin
Copy link
Member

🍾

@wxtim wxtim deleted the i2304_rose-suite-run branch July 25, 2023 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2to3
  
Done
Development

Successfully merging this pull request may close these issues.

Python3 tests dependent on rose-suite-run
6 participants