-
Notifications
You must be signed in to change notification settings - Fork 80
Fix 1812 #2371
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 1812 #2371
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #2371 +/- ##
==========================================
- Coverage 93.78% 93.76% -0.02%
==========================================
Files 163 163
Lines 18615 18643 +28
==========================================
+ Hits 17458 17481 +23
- Misses 1157 1162 +5
Continue to review full report at Codecov.
|
This is ready for review: @josenavas, @ElDeveloper and @wasade. I think 2-3 reviews will be great. The main things to consider while reviewing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment
qiita_db/processing_job.py
Outdated
existing_jobs = qdb.sql_connection.TRN.execute_fetchindex() | ||
if existing_jobs and not force: | ||
raise ValueError( | ||
'Cannot create job because these jobs:\n%s' % '\n'.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Cannot create job because it is a duplicate of these jobs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ... maybe worth including a bit more detail:
Cannot create job because the parameters are the same as jobs that are queued, running or already have succeeded: .....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment in the double list comprehension.
qiita_db/processing_job.py
Outdated
WHERE command_id = %s AND processing_job_status IN ( | ||
'success', 'waiting', 'running') """ | ||
params = " AND ".join( | ||
["command_parameters->>'%s' = '%s'" % (k, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one confusing double conditional list comprehension. for v in v
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixing. Note that this wasn't actually working correctly and I also added some explanation on the steps. Let's see what else this breaks.
qiita_db/processing_job.py
Outdated
existing_jobs = qdb.sql_connection.TRN.execute_fetchindex() | ||
if existing_jobs and not force: | ||
raise ValueError( | ||
'Cannot create job because these jobs:\n%s' % '\n'.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 ... maybe worth including a bit more detail:
Cannot create job because the parameters are the same as jobs that are queued, running or already have succeeded: .....
qiita_db/processing_job.py
Outdated
WHERE command_id = %s AND processing_job_status IN ( | ||
'success', 'waiting', 'running') """ | ||
params = " AND ".join( | ||
["command_parameters->>'%s' = '%s'" % (k, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
@@ -22,7 +22,7 @@ | |||
from qiita_core.qiita_settings import qiita_config | |||
|
|||
|
|||
def _create_job(): | |||
def _create_job(force=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we default to True
, are there situations in the codebase where this is False
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or rather, this API has changed I believe since the existing functionality would be force=False
if I understand the docs above. Will this change be a problem elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...or was the default behavior previously to force the execution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a local function to avoid duplication of code that by default always ignores/forces the duplicated jobs. There is a single test (below) that doesn't force this behavior: _create_job(False)
@antgonza you've test failures here |
Don't merge this as it still needs some work. The code works as expected but the GUI is not catching/working as expected. |
@wasade and @ElDeveloper, could you do another pass? Thanks! |
qiita_db/processing_job.py
Outdated
for k, v in viewitems(parameters.values): | ||
# this is necessary in case we have an Iterable as a value | ||
# but that is not unicode or string | ||
if isinstance(v, Iterable) and not (isinstance(v, str) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isinstance can take a tuple i.e. isinstance(v, (str, unicode))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k, changing
with self.assertRaisesRegexp(ValueError, 'Cannot create job because ' | ||
'the parameters are the same as jobs ' | ||
'that are queued, running or already ' | ||
'have succeeded:'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this passing if this is not a regex, and there's no pattern to match here? Shouldn't there be a job id, or a regex indicating that this should match a job id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause it behaves as an IN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
No description provided.