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

7.8.x patch 1 #2947

Merged
merged 8 commits into from
Mar 14, 2019
Merged

7.8.x patch 1 #2947

merged 8 commits into from
Mar 14, 2019

Conversation

matthewrmshin
Copy link
Contributor

Cherry picked: #2916, #2937, #2941, #2943, #2944.

@matthewrmshin matthewrmshin added this to the next-release milestone Feb 8, 2019
@matthewrmshin matthewrmshin self-assigned this Feb 8, 2019
@oliver-sanders
Copy link
Member

#2916, #2937 probably aren't needed for a bugfix release though should be harmless so fine.

@oliver-sanders
Copy link
Member

Can we get #2938 in?

@matthewrmshin matthewrmshin changed the title 7.8.x patch 7.8.x patch 1 Feb 8, 2019
@matthewrmshin
Copy link
Contributor Author

Yes. We can raise another PR on the 7.8.x branch.

@sadielbartholomew
Copy link
Collaborator

sadielbartholomew commented Feb 8, 2019

Can we get #2938 in?

Yes. We can raise another PR on the 7.8.x branch.

I'm reviewing that PR now to escalate this. Or now will review as soon as it is ready again after discussion off-line.

@hjoliver
Copy link
Member

hjoliver commented Feb 11, 2019

if cylc.flags.debug:
raise
sys.exit(str(exc))
main()
Copy link
Member

Choose a reason for hiding this comment

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

I guess I didn't review the original PR to master, but why this change? (My old "users should see an error message, not a traceback" argument is probably wrong, but we should be consistent, or remove this from all the commands, no?)

Copy link
Contributor Author

@matthewrmshin matthewrmshin Feb 11, 2019

Choose a reason for hiding this comment

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

No, your original assumption was not wrong. However:

  • Time has changed and many users are now familiar enough with Python that the trace back is no longer scary - and it helps us and them when they send us bug reports.
  • Catching known exception (those with nice messages) here is good, but catching all generic exceptions here is not so good - especially when you have those cryptic system errors - which is much better being a trace back.

You are right. I should changed everything.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I'm happy to have this removed from all commands.

Copy link
Member

Choose a reason for hiding this comment

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

Word of warning: In Python3 when you catch an exception its context is not forgotten which results in multi-part traceback which gets really messy really quick.

For example a pattern we use a lot in Cylc is to catch a nasty OSError or KeyError or whatever and raise a more user-friendly CylcException, ConfigError or whatnot. This pattern is at Python3 fundamentally broken as you will end up raising both the original exception as well as the new one.

For example say we are trying to catch ZeroDivisionError and hide it from the user replacing it with a more informative Exception...

>>> try:
...     1/0
... except ZeroDivisionError:
...     # raise a completely different exception
...     raise Exception('foo')
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
Exception: foo

matthewrmshin and others added 8 commits February 25, 2019 16:15
On file system such as an NFS mounted file system, we may have a delay
before the file becomes visible from other process running on other
host. We already have a 1st fsync to ensure that the data of the contact
file is written to disk. This change adds a 2nd fsync to ensure that the
file metadata of the contact file is written as well - by doing an fsync
on its directory.
On SSH call with login shell, sites/users may have logic in profile
scripts writing to STDOUT. This causes the logic that expects JSON to
fail to load the output. This change attempts to drop all lines before
it finds the first open curly bracket `{`, which should be good enough
to denote the start of JSON content in most cases.
So, cylc logger will always have a handler. CylcOptionParser will ensure
that commands will have a valid logging handler. Scheduler will do
likewise for daemonized suites.

Use CylcOptionParser for all remaining user commands:
* cylc cycle-point
* cylc documentation
* cylc get-gui-config
* cylc get-site-config

This ensures that these commands will have logging handlers set.
@hjoliver
Copy link
Member

For future changes that need to target 7.8.x and 8.0, IMO we should raise duplicate separate PRs rather than a combo cherry-pick branch - easier to keep track of what's been merged. Or ask the PR author to do that. (I think this particular combo PR was necessary for historical reasons).

@hjoliver hjoliver requested a review from kinow March 12, 2019 04:48
@hjoliver
Copy link
Member

@kinow - can you do a quick sanity check and merge on this (tomorrow); if @oliver-sanders doesn't overnight.

Copy link
Member

@kinow kinow left a comment

Choose a reason for hiding this comment

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

Changes look good, I remembered a few of them. Also checked out branch locally and tested:

  • cylc run --no-detach --debug --verbose five
  • cylc validate five
  • cylc scan with suite five running
  • cylc cat-log --mode=tail five with suite five running
  • cylc stop with suite five running
  • cylc gui and then launch suite five
  • pytest

All good from what I could tell.

@kinow
Copy link
Member

kinow commented Mar 12, 2019

Spare time after Spanish classes, so reviewed this one @hjoliver . Leave to @oliver-sanders do the final check & merge 👍

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

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

Would have liked to include bugfix #2938 .

@hjoliver
Copy link
Member

Would have liked to include bugfix #2938 .

That fix can still go in as another PR - no need to block this merge, is there?

@matthewrmshin
Copy link
Contributor Author

This is patch 1. There can be many more.

@hjoliver hjoliver merged commit 36d68c2 into cylc:7.8.x Mar 14, 2019
@matthewrmshin matthewrmshin deleted the 7.8.x-patch branch June 3, 2019 11:26
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.

5 participants