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

Fix hang in graph with absolute point as offset #2088

Merged

Conversation

matthewrmshin
Copy link
Contributor

@matthewrmshin matthewrmshin commented Dec 16, 2016

Improve cutoff point for absolute offset.

  • Use stop point of sequence as cutoff point.

Improve error message for bad recurrence syntax
Allow long date-time format in graph offset.
Document performance issue with immortal fixed cycle point tasks.

Fix #1394 (and #1951).

@matthewrmshin matthewrmshin added the bug Something is wrong :( label Dec 16, 2016
@matthewrmshin matthewrmshin added this to the next release milestone Dec 16, 2016
@matthewrmshin matthewrmshin self-assigned this Dec 16, 2016
@@ -127,6 +127,8 @@ def __str__(self):
# Stringify.
return self.value

__repr__ = __str__
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Friendlier display in print statements.

if target_point == my_point:
# We have found a dependent_point for my_point.
matching_dependent_points.append(dependent_point)
my_cutoff_point = dependent_point
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't see why we need an array when only its last value is used later.

@oliver-sanders
Copy link
Member

The example suite in #1394 will stall if run as the start task is not retained in the pool.

@oliver-sanders
Copy link
Member

oliver-sanders commented Dec 16, 2016

Needs a test for ISO8601 absolute points. The following suite fails validation with 'NoneType' object has no attribute 'set_time_zone' due to the foo[20000102T00Z] bit.

[cylc]
    UTC mode = True
[scheduling]
    initial cycle point = 20000101T00Z
    [[dependencies]]
        [[[R1]]]
            graph = start
        [[[T00]]]
            graph = start[^] => foo
        [[[20000102T12Z]]]
            graph = foo[20000102T00Z] => bar

@matthewrmshin
Copy link
Contributor Author

The example suite in #1394 will stall if run as the start task is not retained in the pool.

(Looks like we have discovered even more badness in the code.)

__SUITE_RC__

run_ok "${TEST_NAME_BASE}-datetime" cylc validate 'suite.rc'

Copy link
Contributor

@arjclark arjclark Dec 16, 2016

Choose a reason for hiding this comment

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

Test should actually run the suite to ensure it is working (as opposed to just bypassing a validation issue)

@matthewrmshin matthewrmshin force-pushed the fix-graph-absolute-as-offset-hang branch from c0ff271 to 508f862 Compare December 16, 2016 12:28
if not other:
return False
if other is None:
return -1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning False would be equivalent to returning 0 - self == other if other is None, etc.

@matthewrmshin
Copy link
Contributor Author

Now running the previously bad suites, instead of just validating them.

@matthewrmshin
Copy link
Contributor Author

matthewrmshin commented Dec 16, 2016

The 'NoneType' object has no attribute 'set_time_zone' problem was a configuration syntax error. The 20000102T12Z section needs to be R1/20000102T12Z. I have added a better error message for this.

@matthewrmshin
Copy link
Contributor Author

Should all be good now.

@matthewrmshin
Copy link
Contributor Author

(See also #1773.)

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

Just a couple of minor questions.

graph = "baz[20200101] => qux"
\end{lstlisting}
\lstset{language=transcript}

Copy link
Member

Choose a reason for hiding this comment

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

We should explain why this is BAD, because having a small number of immortal task proxies doesn't seem like it should be so terrible. I presume you mean because iteration across the ever-increasing range of cycle points can become a performance issue? Even so, is it worse in that respect than baz[^] => qux in a cycling section, which I see quite a lot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is the same as baz[^] => qux in a cycling section (see #1773). I'll explain the performance issue in the docs for now.

self.cfg['scheduling']['final cycle point'])
except (AttributeError, TypeError):
raise SuiteConfigError(
"ERROR: Invalid recurrence representation: %s" % section)
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, do we know for a fact that only bad recurrence expressions cause AttributeError and TypeError here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the statement in the try: block above, the argument to the get_sequence function are the section title (which should be a cycle point recurrence), the initial cycle point and the final cycle point.

The initial and final cycle points should already have their syntaxes checked earlier, so the only thing that can cause exception here should be invalid or unsupported recurrence syntax, or a bug in our system.

@hjoliver
Copy link
Member

(tests as working, btw).

@oliver-sanders
Copy link
Member

Note this will currently fail for some of the more exotic ISO8601 datetime formats:

  • 2000-01-01T0000
  • 20000101T00:00
  • 2000-W01-01T0000
  • 2000-001T0000
  • 20000101T00,0
  • 20000101T00.0
  • 20000101T0000-00:00

@hjoliver
Copy link
Member

It should presumably accept the configured cycle point format of the suite, at the least.

@matthewrmshin
Copy link
Contributor Author

Maybe even more badness in the date-time parsing logic?

@hjoliver
Copy link
Member

Can you consult with Ben over morning tea? 😄

@matthewrmshin
Copy link
Contributor Author

Actually, I cannot see how any of the above can work.

  • 2000-01-01T0000
    • mixed format - long format for date and short format for time
  • 20000101T00:00
    • mixed format - short format for date and long format for time
  • 2000-W01-01T0000
    • syntax error: day of week should be single digit
  • 2000-001T0000
    • mixed format
  • 20000101T00,0 and 20000101T00.0
    • any usage for these?
  • 20000101T0000-00:00
    • mixed format - time zone in long format, the rest in short format

Note: section header appears to be OK with long format or short format, but not both. For offset, the regular expression appears to only support the short format - as the colon : character is not included. I'll see if we have any badness for supporting the colon character in offset, but maybe this is better for a different issue?

@hjoliver
Copy link
Member

I guess those formats were a bit too exotic 😬

@matthewrmshin matthewrmshin force-pushed the fix-graph-absolute-as-offset-hang branch from 81122a2 to 91233ac Compare December 19, 2016 11:05
@matthewrmshin
Copy link
Contributor Author

I have now added the colon : character to the regular expression for offset. It does not appear to cause any badness yet.

Improve cutoff point for absolute offset.
* Use stop point of sequence as cutoff point.
Improve error message for bad recurrence syntax
Allow long date-time format in graph offset.
Document performance issue with immortal fixed cycle point tasks.
@matthewrmshin matthewrmshin force-pushed the fix-graph-absolute-as-offset-hang branch from 91233ac to 7f2762a Compare December 19, 2016 11:26
@matthewrmshin
Copy link
Contributor Author

Branch squashed and rebased.

@arjclark
Copy link
Contributor

@oliver-sanders - given all your recent testing etc. of this can you do the review 2 of this please.

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.

The addition of the : colon to the regex satisfies my ISO8601 concerns.

Looks OK, passes tests.

@hjoliver hjoliver merged commit 0e322b8 into cylc:master Dec 20, 2016
@matthewrmshin matthewrmshin deleted the fix-graph-absolute-as-offset-hang branch January 4, 2017 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of absolute cycle points in graph offsets.
4 participants