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

Fixes for some issues with rose_ana KGO database #2047

Merged
merged 5 commits into from
Feb 9, 2017

Conversation

stevewardle
Copy link
Contributor

Two slight problems have been identified with this functionality (though the impact is limited, only to those making use of the KGO database). Two different problems exist:

1. The rose_ana re-write moved to using a buffer for the statment (to avoid many repeated calls to locking and/or commits to the database. Unfortunately this defeats the point of the tasks database table - the original idea was that this table would initially be set to 1 for each task, and updated to 0 when the task finished (allowing scripts interfacing with the database the means to understand when something unexpected had stopped the task completing)... Due to the use of the buffer everything is done in one go, meaning an unexpected error results in nothing being written instead. The solution is to have 2 calls per rose_ana task instead (one to set the tasks table entry at the start)

2. At some point during the writing of the analysis modules both externally and for the grepper.py class, the _kgo_db_add_file_pair method was somehow forgotten/overlooked and tasks instead directly called self.parent.kgo_db.add_comparison... this meant losing the behaviour of making the table key unique by appending the rose_ana task name. Rather than fix the call in grepper.py and elsewhere it seems a little redundant having the _kgo_db_* methods at all in the app class, so these are now dropped

@matthewrmshin matthewrmshin added this to the next-release milestone Feb 7, 2017
@stevewardle
Copy link
Contributor Author

Okay passing the built-in tests - I'll run it on a proper case in our UM rose suite as well to make sure it solves the problems we were seeing before. If possible it would be great if this went on (to at least rose-next at the Met Office) before 28th Feb - since I currently have had to commit a few workarounds to the UM trunk; it'd be good to be able to revert those before the official release - @matthewrmshin any chance this is possible?

…hat one

write happens at the beginning and one at the end!
@stevewardle
Copy link
Contributor Author

Apologies for changing it after the review request - it's a trivial change as I spotted that the message in stdout looked silly being at the start + end of the app run

# Prepend the task_name onto each entry, to try and ensure it is
# unique (the individual comparison names may not be, but the rose
# task name + the comparison task name should)
sql_args = [self.task_name + " - " + app_task,
Copy link
Contributor

Choose a reason for hiding this comment

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

You're adding self.task_name to app_task here, but they're set to the same thing on line 105 aren't they?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see that it looks that way, but despite the argument names both being app_task, one is set by rose_ana itself to the Rose task name (the one which is saved to self.task_name) but the other one (passed to enter_comparison) is supplied by the user, and can be anything - though by convention it uses the section name from the app... I could perhaps rename the arguments to make this more obvious?

@@ -101,7 +112,8 @@ def database_lock(self, lockfile, reporter=None):
if reporter is not None:
reporter("Acquired DB lock at: " + time.asctime())
lock.write("{0}".format(os.getpid()))
reporter("Writing results to KGO Database...")
if reporter is not None:
reporter("Writing to KGO Database...")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this for debugging only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I think this is as intended (I just realised it ought to be protected in the same way the other statements are)

@matthewrmshin matthewrmshin merged commit e3c4521 into metomi:master Feb 9, 2017
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.

3 participants