Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jedwards4b
Copy link
Contributor

Move the flag that indicates an xml file needs to be rewritten from the case object to the individual file objects and before writing a value confirm that that value is not already the same as the file value.

Test suite: scripts_regression_tests.py (running full cesm prealpha test suite in progress)
Test baseline: cesm2_0_alpha10f
Test namelist changes: none
Test status: bit for bit
Addresses #2448

User interface changes?:

Update gh-pages html (Y/N)?:

Code review: @jgfouca

@jedwards4b jedwards4b force-pushed the smarter_xmlchange branch from 5cc7f6a to 7d52ca8 Compare May 10, 2018 12:48
@jedwards4b
Copy link
Contributor Author

@jgfouca cheyenne crashed again this morning delaying the complete testing we would like to do on this PR. However I was able to do a pretty good subset of that testing last night and I'm pretty satisfied that it's ready to go. Your careful review would be very much appreciated.

Copy link
Contributor

@jgfouca jgfouca left a comment

Choose a reason for hiding this comment

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

I very much like the idea behind the PR. It makes much more sense to manage this in generic_xml. See inline comments.

return node.xml_element.set(attrib_name, value)

def pop(self, node, attrib_name):
expect(not self.read_only, "locked")
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 you need a needsrewrite set to True here.

def read_xml(self):
if self._env_files_that_need_rewrite:
expect(False, "Object(s) {} seem to have newer data than the corresponding case file".format(" ".join([env_file.filename for env_file in self._env_files_that_need_rewrite])))
# if any self._files.needrewrite:
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete?

self.read_only = read_only
self.filename = infile
self.needsrewrite = False
if infile is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

In the read or read_fd function below, you can check if needsrewrite is True, if so, we are about to blow away someone's modifications and should raise an error.

@jgfouca
Copy link
Contributor

jgfouca commented May 10, 2018

Testing complete?

@jedwards4b
Copy link
Contributor Author

One of the new changes causes FAIL: test_a_createnewcase (main.J_TestCreateNewcase)
I haven't figured out why yet.

@jedwards4b jedwards4b changed the title Smarter xmlchange (Testing in progress) Smarter xmlchange May 10, 2018
@jedwards4b
Copy link
Contributor Author

Okay that problem is solved. All testing complete.

@jedwards4b jedwards4b merged commit f1db9c6 into ESMCI:master May 10, 2018
@jedwards4b jedwards4b deleted the smarter_xmlchange branch May 10, 2018 19:50
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.

2 participants