)]}'
{"networking_odl/db/db.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"@oslo_db_api.wrap_db_retry(max_retries\u003ddb_api.MAX_RETRIES)"},{"line_number":158,"context_line":"def create_task_if_not_registered(session, task):"},{"line_number":159,"context_line":"    row \u003d models.OpendaylightPeriodicTask(state\u003dodl_const.PENDING,"},{"line_number":160,"context_line":"                                          processing_operation\u003dNone,"},{"line_number":161,"context_line":"                                          task\u003dtask,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_38cec559","line":158,"range":{"start_line":158,"start_character":4,"end_line":158,"end_character":33},"updated":"2017-06-18 12:09:58.000000000","message":"This isn\u0027t necessary as the locks are constant per system and not something dynamic thats created on demand.\n\nInstead of some sort of \"lazy\" creation logic they can be simply all inserted into the DB during upgrade time.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":155,"context_line":""},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"@oslo_db_api.wrap_db_retry(max_retries\u003ddb_api.MAX_RETRIES)"},{"line_number":158,"context_line":"def create_task_if_not_registered(session, task):"},{"line_number":159,"context_line":"    row \u003d models.OpendaylightPeriodicTask(state\u003dodl_const.PENDING,"},{"line_number":160,"context_line":"                                          processing_operation\u003dNone,"},{"line_number":161,"context_line":"                                          task\u003dtask,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_997b988a","line":158,"range":{"start_line":158,"start_character":4,"end_line":158,"end_character":33},"in_reply_to":"7f231b9d_38cec559","updated":"2017-06-19 05:06:28.000000000","message":"If we do this way then we have to update database schema each time new task are being introduced. Do you still think, it is good idea to it that way?","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"def lock_periodic_task(session, task, interval):"},{"line_number":186,"context_line":"    time_diff \u003d session.execute(func.now()).scalar() - interval"},{"line_number":187,"context_line":"    row \u003d session.query(models.OpendaylightPeriodicTask).filter("},{"line_number":188,"context_line":"        models.OpendaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":189,"context_line":"        (time_diff \u003e\u003d models.OpendaylightPeriodicTask.lock_updated)"},{"line_number":190,"context_line":"    ).one_or_none()"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"    # If the time difference between lock updated on a task and current time"},{"line_number":193,"context_line":"    # is greater than interval only then lock will be acquired."},{"line_number":194,"context_line":"    if not row:"},{"line_number":195,"context_line":"        return False"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    return _update_periodic_task_state(session, odl_const.PENDING,"},{"line_number":198,"context_line":"                                       odl_const.PROCESSING, task)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_b80bf58b","line":195,"range":{"start_line":186,"start_character":4,"end_line":195,"end_character":20},"updated":"2017-06-18 12:09:58.000000000","message":"Can\u0027t this potentially cause unlock not to unlock the task?\n\nEither way this logic seems more high level to me and I wouldn\u0027t put it in the DAL.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":183,"context_line":""},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"def lock_periodic_task(session, task, interval):"},{"line_number":186,"context_line":"    time_diff \u003d session.execute(func.now()).scalar() - interval"},{"line_number":187,"context_line":"    row \u003d session.query(models.OpendaylightPeriodicTask).filter("},{"line_number":188,"context_line":"        models.OpendaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":189,"context_line":"        (time_diff \u003e\u003d models.OpendaylightPeriodicTask.lock_updated)"},{"line_number":190,"context_line":"    ).one_or_none()"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"    # If the time difference between lock updated on a task and current time"},{"line_number":193,"context_line":"    # is greater than interval only then lock will be acquired."},{"line_number":194,"context_line":"    if not row:"},{"line_number":195,"context_line":"        return False"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"    return _update_periodic_task_state(session, odl_const.PENDING,"},{"line_number":198,"context_line":"                                       odl_const.PROCESSING, task)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_f9616cd4","line":195,"range":{"start_line":186,"start_character":4,"end_line":195,"end_character":20},"in_reply_to":"7f231b9d_b80bf58b","updated":"2017-06-19 05:06:28.000000000","message":"ok, i will move it to the place where lock is to be acquired.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":172,"context_line":"    return session.query(models.OpenDaylightPeriodicTask).filter("},{"line_number":173,"context_line":"        models.OpenDaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 interval))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"def lock_periodic_task(session, task):"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_8402c73d","line":175,"range":{"start_line":175,"start_character":17,"end_line":175,"end_character":25},"updated":"2017-07-10 12:23:15.000000000","message":"Shouldn\u0027t you be wrapping this in \"datetime.timedelta(seconds\u003d*)\"? Does this work fine without it?\n\nIn all examples I see timedelta is used for comparing time in the DB.","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    with session.begin():"},{"line_number":159,"context_line":"        row \u003d session.query(models.OpenDaylightPeriodicTask).filter_by("},{"line_number":160,"context_line":"            state\u003dexpected_state,"},{"line_number":161,"context_line":"            task\u003dtask).with_for_update().one_or_none()"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"        if row is None:"},{"line_number":164,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_82562606","line":161,"range":{"start_line":161,"start_character":23,"end_line":161,"end_character":38},"updated":"2017-07-10 21:23:50.000000000","message":"we can use optimistic lock. anyway it can be addressed with another patch.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"b1f6d723e462e05b4f1a708951ad8389b813a748","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    with session.begin():"},{"line_number":159,"context_line":"        row \u003d session.query(models.OpenDaylightPeriodicTask).filter_by("},{"line_number":160,"context_line":"            state\u003dexpected_state,"},{"line_number":161,"context_line":"            task\u003dtask).with_for_update().one_or_none()"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"        if row is None:"},{"line_number":164,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_f2a0fda7","line":161,"range":{"start_line":161,"start_character":23,"end_line":161,"end_character":38},"in_reply_to":"3f1d235d_82562606","updated":"2017-07-11 07:14:37.000000000","message":"If you believe that it\u0027s better then it could be part of this patch as it\u0027s already introducing a DB migration script.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    with session.begin():"},{"line_number":159,"context_line":"        row \u003d session.query(models.OpenDaylightPeriodicTask).filter_by("},{"line_number":160,"context_line":"            state\u003dexpected_state,"},{"line_number":161,"context_line":"            task\u003dtask).with_for_update().one_or_none()"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"        if row is None:"},{"line_number":164,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_7cce06b5","line":161,"range":{"start_line":161,"start_character":23,"end_line":161,"end_character":38},"in_reply_to":"3f1d235d_82562606","updated":"2017-07-12 07:20:03.000000000","message":"OK, i will do in separate patch.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":169,"context_line":""},{"line_number":170,"context_line":"def was_periodic_task_executed_recently(session, task, interval):"},{"line_number":171,"context_line":"    now \u003d session.execute(func.now()).scalar()"},{"line_number":172,"context_line":"    row \u003d session.query(models.OpenDaylightPeriodicTask).filter("},{"line_number":173,"context_line":"        models.OpenDaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 datetime.timedelta(seconds\u003dinterval)))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    if row is None:"},{"line_number":178,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_827d0670","line":175,"range":{"start_line":172,"start_character":0,"end_line":175,"end_character":70},"updated":"2017-07-10 21:23:50.000000000","message":"This filter can be integrated into the line 159-161.\ni.e. take lock if it\u0027s not run recently.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"b1f6d723e462e05b4f1a708951ad8389b813a748","unresolved":false,"context_lines":[{"line_number":169,"context_line":""},{"line_number":170,"context_line":"def was_periodic_task_executed_recently(session, task, interval):"},{"line_number":171,"context_line":"    now \u003d session.execute(func.now()).scalar()"},{"line_number":172,"context_line":"    row \u003d session.query(models.OpenDaylightPeriodicTask).filter("},{"line_number":173,"context_line":"        models.OpenDaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 datetime.timedelta(seconds\u003dinterval)))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    if row is None:"},{"line_number":178,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_12993978","line":175,"range":{"start_line":172,"start_character":0,"end_line":175,"end_character":70},"in_reply_to":"3f1d235d_827d0670","updated":"2017-07-11 07:14:37.000000000","message":"I told him to separate it since last implemntation wasnt really part of the DB, but seeing as now it has to rely on DB to synchronize the time I think this comment makes sense.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":169,"context_line":""},{"line_number":170,"context_line":"def was_periodic_task_executed_recently(session, task, interval):"},{"line_number":171,"context_line":"    now \u003d session.execute(func.now()).scalar()"},{"line_number":172,"context_line":"    row \u003d session.query(models.OpenDaylightPeriodicTask).filter("},{"line_number":173,"context_line":"        models.OpenDaylightPeriodicTask.task \u003d\u003d task,"},{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 datetime.timedelta(seconds\u003dinterval)))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    if row is None:"},{"line_number":178,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_3c452e16","line":175,"range":{"start_line":172,"start_character":0,"end_line":175,"end_character":70},"in_reply_to":"3f1d235d_827d0670","updated":"2017-07-12 07:20:03.000000000","message":"I would like these things to be separate because that task also handles unlocking. It would keep things cleam.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 datetime.timedelta(seconds\u003dinterval)))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    if row is None:"},{"line_number":178,"context_line":"        return True"},{"line_number":179,"context_line":"    else:"},{"line_number":180,"context_line":"        return False"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"def lock_periodic_task(session, task):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_223632e9","line":180,"range":{"start_line":177,"start_character":0,"end_line":180,"end_character":20},"updated":"2017-07-10 21:23:50.000000000","message":"return row is None.\nmaybe bool(row is None) to be explicit.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        (now \u003e\u003d (models.OpenDaylightPeriodicTask.lock_updated +"},{"line_number":175,"context_line":"                 datetime.timedelta(seconds\u003dinterval)))).one_or_none()"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    if row is None:"},{"line_number":178,"context_line":"        return True"},{"line_number":179,"context_line":"    else:"},{"line_number":180,"context_line":"        return False"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":""},{"line_number":183,"context_line":"def lock_periodic_task(session, task):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_fc4e9636","line":180,"range":{"start_line":177,"start_character":0,"end_line":180,"end_character":20},"in_reply_to":"3f1d235d_223632e9","updated":"2017-07-12 07:20:03.000000000","message":"Done","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    with session.begin():"},{"line_number":204,"context_line":"        row \u003d session.query(models.OpenDaylightPeriodicTask).filter_by("},{"line_number":205,"context_line":"            task\u003dtask).one_or_none()"},{"line_number":206,"context_line":"        row.processing_operation \u003d op_text"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def delete_rows_by_state_and_time(session, state, time_delta):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_2292b2a0","line":206,"range":{"start_line":205,"start_character":23,"end_line":206,"end_character":42},"updated":"2017-07-10 21:23:50.000000000","message":"This assumes that the row always exists?\nif so, one() should be used instead of one_or_none().","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    with session.begin():"},{"line_number":204,"context_line":"        row \u003d session.query(models.OpenDaylightPeriodicTask).filter_by("},{"line_number":205,"context_line":"            task\u003dtask).one_or_none()"},{"line_number":206,"context_line":"        row.processing_operation \u003d op_text"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def delete_rows_by_state_and_time(session, state, time_delta):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_7c5cc6ec","line":206,"range":{"start_line":205,"start_character":23,"end_line":206,"end_character":42},"in_reply_to":"3f1d235d_2292b2a0","updated":"2017-07-12 07:20:03.000000000","message":"Done","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/db/migration/alembic_migrations/versions/pike/contract/eccd865b7d3a_drop_opendaylight_maintenance_table.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2017 \u003cPUT YOUR NAME/COMPANY HERE\u003e"},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_98fef968","line":1,"range":{"start_line":1,"start_character":17,"end_line":1,"end_character":45},"updated":"2017-06-18 12:09:58.000000000","message":"nit: missing company name","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"}],"networking_odl/db/migration/alembic_migrations/versions/pike/expand/6f7dfb241354_create_opendaylight_preiodic_task_table.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2017 \u003cPUT YOUR NAME/COMPANY HERE\u003e"},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_7801dd69","line":1,"range":{"start_line":1,"start_character":18,"end_line":1,"end_character":45},"updated":"2017-06-18 12:09:58.000000000","message":"nit: missing company name","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   name\u003d\u0027state\u0027),"},{"line_number":40,"context_line":"                  nullable\u003dFalse),"},{"line_number":41,"context_line":"        sa.Column(\u0027processing_operation\u0027, sa.String(70)),"},{"line_number":42,"context_line":"        sa.Column(\u0027task\u0027, sa.String(70), unique\u003dTrue),"},{"line_number":43,"context_line":"        sa.Column(\u0027lock_updated\u0027, sa.TIMESTAMP, nullable\u003dFalse,"},{"line_number":44,"context_line":"                  server_default\u003dsa.func.now(),"},{"line_number":45,"context_line":"                  onupdate\u003dsa.func.now())"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_38f7e58d","line":42,"range":{"start_line":42,"start_character":0,"end_line":42,"end_character":54},"updated":"2017-06-18 12:09:58.000000000","message":"I\u0027d set this as the PK then and drop the ID (and HasId on the model)","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":39,"context_line":"                                   name\u003d\u0027state\u0027),"},{"line_number":40,"context_line":"                  nullable\u003dFalse),"},{"line_number":41,"context_line":"        sa.Column(\u0027processing_operation\u0027, sa.String(70)),"},{"line_number":42,"context_line":"        sa.Column(\u0027task\u0027, sa.String(70), unique\u003dTrue),"},{"line_number":43,"context_line":"        sa.Column(\u0027lock_updated\u0027, sa.TIMESTAMP, nullable\u003dFalse,"},{"line_number":44,"context_line":"                  server_default\u003dsa.func.now(),"},{"line_number":45,"context_line":"                  onupdate\u003dsa.func.now())"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_79267c6a","line":42,"range":{"start_line":42,"start_character":0,"end_line":42,"end_character":54},"in_reply_to":"7f231b9d_38f7e58d","updated":"2017-06-19 05:06:28.000000000","message":"ok, i will fix it next patch.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                  server_default\u003dsa.func.now(),"},{"line_number":44,"context_line":"                  onupdate\u003dsa.func.now())"},{"line_number":45,"context_line":"    )"},{"line_number":46,"context_line":"    op.bulk_insert(periodic_table,"},{"line_number":47,"context_line":"                   [{\u0027task\u0027: \u0027maintenance\u0027,"},{"line_number":48,"context_line":"                     \u0027state\u0027: odl_const.PENDING}],"},{"line_number":49,"context_line":"                   [{\u0027task\u0027: \u0027hostconfig\u0027,"},{"line_number":50,"context_line":"                     \u0027state\u0027: odl_const.PENDING}])"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_826f46c4","line":50,"range":{"start_line":46,"start_character":0,"end_line":50,"end_character":50},"updated":"2017-07-10 21:23:50.000000000","message":"What if we\u0027d like to add/remove tasks?","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                  server_default\u003dsa.func.now(),"},{"line_number":44,"context_line":"                  onupdate\u003dsa.func.now())"},{"line_number":45,"context_line":"    )"},{"line_number":46,"context_line":"    op.bulk_insert(periodic_table,"},{"line_number":47,"context_line":"                   [{\u0027task\u0027: \u0027maintenance\u0027,"},{"line_number":48,"context_line":"                     \u0027state\u0027: odl_const.PENDING}],"},{"line_number":49,"context_line":"                   [{\u0027task\u0027: \u0027hostconfig\u0027,"},{"line_number":50,"context_line":"                     \u0027state\u0027: odl_const.PENDING}])"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_dc04fac8","line":50,"range":{"start_line":46,"start_character":0,"end_line":50,"end_character":50},"in_reply_to":"3f1d235d_826f46c4","updated":"2017-07-12 07:20:03.000000000","message":"Then it will require addition of a db migration scripts. I had discussion with Mike.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"b1f6d723e462e05b4f1a708951ad8389b813a748","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                  server_default\u003dsa.func.now(),"},{"line_number":44,"context_line":"                  onupdate\u003dsa.func.now())"},{"line_number":45,"context_line":"    )"},{"line_number":46,"context_line":"    op.bulk_insert(periodic_table,"},{"line_number":47,"context_line":"                   [{\u0027task\u0027: \u0027maintenance\u0027,"},{"line_number":48,"context_line":"                     \u0027state\u0027: odl_const.PENDING}],"},{"line_number":49,"context_line":"                   [{\u0027task\u0027: \u0027hostconfig\u0027,"},{"line_number":50,"context_line":"                     \u0027state\u0027: odl_const.PENDING}])"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_929b0965","line":50,"range":{"start_line":46,"start_character":0,"end_line":50,"end_character":50},"in_reply_to":"3f1d235d_826f46c4","updated":"2017-07-11 07:14:37.000000000","message":"This has been discussed previously, please check the change history.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/db/models.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                             onupdate\u003dsa.func.now())"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"class OpenDaylightPeriodicTask(model_base.BASEV2, model_base.HasId):"},{"line_number":46,"context_line":"    __tablename__ \u003d \u0027opendaylight_periodic_task\u0027"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    state \u003d sa.Column(sa.Enum(odl_const.PENDING, odl_const.PROCESSING),"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_a4e023fc","line":45,"range":{"start_line":45,"start_character":50,"end_line":45,"end_character":66},"updated":"2017-07-10 12:23:15.000000000","message":"This is unnecesssary as the task name is essentially (and should be defined as) the primary key here.","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"}],"networking_odl/journal/periodic_task.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":35,"context_line":"class PeriodicTask(object):"},{"line_number":36,"context_line":"    def __init__(self):"},{"line_number":37,"context_line":"        self.timer \u003d loopingcall.FixedIntervalLoopingCall(self.execute_ops)"},{"line_number":38,"context_line":"        self.db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":39,"context_line":"        self.interval \u003d cfg.CONF.ml2_odl.maintenance_interval"},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"        # Format of tasks is following"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_f8484db3","line":38,"range":{"start_line":38,"start_character":26,"end_line":38,"end_character":61},"updated":"2017-06-18 12:09:58.000000000","message":"An ORM session usualy contains cache and maybe even an open transaction, why would you want to keep it on the thread level?","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":87,"context_line":"            for phase in phases:"},{"line_number":88,"context_line":"                self._execute_op(task, phase)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"            db.unlock_periodic_task(self.db_session, task)"},{"line_number":91,"context_line":"            LOG.debug(\"%s task has been finished\", task)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    def register_operation(self, task, phase):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_b86895f4","line":90,"range":{"start_line":90,"start_character":12,"end_line":90,"end_character":58},"updated":"2017-06-18 12:09:58.000000000","message":"Unlock should be inside finally like it was in the original implementation","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            # When a task is being registered first time"},{"line_number":105,"context_line":"            db.create_task_if_not_registered(self.db_session, task)"},{"line_number":106,"context_line":"            self.tasks[task] \u003d [phase]"},{"line_number":107,"context_line":"            LOG.error(\"%s phase in %s task has been registered\","},{"line_number":108,"context_line":"                      phase.__name__, task)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_187f89ab","line":107,"range":{"start_line":107,"start_character":16,"end_line":107,"end_character":21},"updated":"2017-06-18 12:09:58.000000000","message":"Why error?","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":27,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"# To make sure only one thread exist in a process."},{"line_number":31,"context_line":"# However other task can be executed by other worker process\u0027s thread"},{"line_number":32,"context_line":"class PeriodicTask(object):"},{"line_number":33,"context_line":"    tasks \u003d dict()"},{"line_number":34,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_00175953","line":31,"range":{"start_line":30,"start_character":0,"end_line":31,"end_character":69},"updated":"2017-07-05 07:08:09.000000000","message":"This comment isn\u0027t relevant anymore","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":30,"context_line":"# To make sure only one thread exist in a process."},{"line_number":31,"context_line":"# However other task can be executed by other worker process\u0027s thread"},{"line_number":32,"context_line":"class PeriodicTask(object):"},{"line_number":33,"context_line":"    tasks \u003d dict()"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def __init__(self, task, interval\u003dNone):"},{"line_number":36,"context_line":"        self.task \u003d task"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_9348615c","line":33,"range":{"start_line":33,"start_character":4,"end_line":33,"end_character":18},"updated":"2017-07-05 07:08:09.000000000","message":"Do you really need a dict of dicts here?\n\nSince each instance of the class represents one task I don\u0027t see how the dict will have more than one entry.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":35,"context_line":"    def __init__(self, task, interval\u003dNone):"},{"line_number":36,"context_line":"        self.task \u003d task"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"        # Format of tasks is following"},{"line_number":39,"context_line":"        # tasks \u003d {"},{"line_number":40,"context_line":"        #     \u0027task_name\u0027: {"},{"line_number":41,"context_line":"        #         \u0027timer\u0027: timer,"},{"line_number":42,"context_line":"        #         \u0027phases\u0027: [phase1, phase2]"},{"line_number":43,"context_line":"        #         \u0027interval\u0027: 10"},{"line_number":44,"context_line":"        #     }"},{"line_number":45,"context_line":"        # }"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"        if not interval:"},{"line_number":48,"context_line":"            interval \u003d cfg.CONF.ml2_odl.maintenance_interval"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_73b3854e","line":45,"range":{"start_line":38,"start_character":0,"end_line":45,"end_character":11},"updated":"2017-07-05 07:08:09.000000000","message":"Irrelevant","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":44,"context_line":"        #     }"},{"line_number":45,"context_line":"        # }"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"        if not interval:"},{"line_number":48,"context_line":"            interval \u003d cfg.CONF.ml2_odl.maintenance_interval"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        if task not in self.tasks:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_930061ad","line":47,"range":{"start_line":47,"start_character":10,"end_line":47,"end_character":23},"updated":"2017-07-05 07:08:09.000000000","message":"Per PEP8 recommendation this should be \"interval is not None\":\n\nhttps://www.python.org/dev/peps/pep-0008/#programming-recommendations\n\nComparisons to singletons like None should always be done with is or is not , never the equality operators.\n\nAlso, beware of writing if x when you really mean if x is not None -- e.g. when testing whether a variable or argument that defaults to None was set to some other value. The other value might have a type (such as a container) that could be false in a boolean context!","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":48,"context_line":"            interval \u003d cfg.CONF.ml2_odl.maintenance_interval"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        if task not in self.tasks:"},{"line_number":51,"context_line":"            db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":52,"context_line":"            db.create_task_if_not_registered(db_session, self.task)"},{"line_number":53,"context_line":"            self.timer \u003d loopingcall.FixedIntervalLoopingCall(self.execute_ops)"},{"line_number":54,"context_line":"            PeriodicTask.tasks[task] \u003d {"},{"line_number":55,"context_line":"                \u0027timer\u0027: self.timer,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_333e2d8c","line":52,"range":{"start_line":51,"start_character":12,"end_line":52,"end_character":67},"updated":"2017-07-05 07:08:09.000000000","message":"I don\u0027t think this is the right way that each time the system starts it will try to create these entries.\n\nSince theyre constant they need to constantly be in the DB.\n\nYes each time a new task is added it will require a very simple DB migration script and since we\u0027re not backporting features I don\u0027t see any problem with this approach.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":56,"context_line":"                \u0027interval\u0027: interval"},{"line_number":57,"context_line":"            }"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":"            PeriodicTask.tasks[task][\u0027phases\u0027] \u003d []"},{"line_number":60,"context_line":"            self.interval \u003d interval"},{"line_number":61,"context_line":"        else:"},{"line_number":62,"context_line":"            self.timer \u003d self.tasks[task][\u0027timer\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f3f555ee","line":59,"range":{"start_line":59,"start_character":12,"end_line":59,"end_character":51},"updated":"2017-07-05 07:08:09.000000000","message":"Should be just a field of the class.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        try:"},{"line_number":85,"context_line":"            LOG.info(\"Starting %s phase of periodic task %s.\","},{"line_number":86,"context_line":"                     op_details, self.task)"},{"line_number":87,"context_line":"            db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":88,"context_line":"            db.update_periodic_task(db_session, task\u003dself.task,"},{"line_number":89,"context_line":"                                    operation\u003doperation)"},{"line_number":90,"context_line":"            operation(session\u003ddb_session)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_13b451f1","line":87,"range":{"start_line":87,"start_character":0,"end_line":87,"end_character":60},"updated":"2017-07-05 07:08:09.000000000","message":"You should reuse the session from the loop instead of creating a new one","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":93,"context_line":"            LOG.exception(\"Failed during periodic task operation %s.\","},{"line_number":94,"context_line":"                          op_details)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def is_period_greater_than_interval(self):"},{"line_number":97,"context_line":"        db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":98,"context_line":"        t \u003d db.get_db_row_by_task(db_session, self.task)"},{"line_number":99,"context_line":"        now \u003d datetime.datetime.now()"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_93750135","line":96,"range":{"start_line":96,"start_character":8,"end_line":96,"end_character":39},"updated":"2017-07-05 07:08:09.000000000","message":"Confusing name, how about \"task_already_executed_recently\" and then you can drop the \"not\" on line 112","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":96,"context_line":"    def is_period_greater_than_interval(self):"},{"line_number":97,"context_line":"        db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":98,"context_line":"        t \u003d db.get_db_row_by_task(db_session, self.task)"},{"line_number":99,"context_line":"        now \u003d datetime.datetime.now()"},{"line_number":100,"context_line":"        interval \u003d datetime.timedelta(seconds\u003dself.interval)"},{"line_number":101,"context_line":"        if t and t.lock_updated + interval \u003c\u003d now:"},{"line_number":102,"context_line":"            return True"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_73d5c5e4","line":99,"range":{"start_line":99,"start_character":14,"end_line":99,"end_character":37},"updated":"2017-07-05 07:08:09.000000000","message":"Problem with this is that the DB clock isn\u0027t necessarily in sync with the host clock and on HA although the clocks should be in sync this can\u0027t be guaranteed.\nBest way is to check the value against the time in the DB.\n\nThis should probably be done in the DB layer so line 98 would be a call accepting interval and returning the task only if the interval has passed (probably the function name should change accordingly).\n\nYou can see an example of how to do something like this on \nhttps://github.com/openstack/networking-odl/blob/master/networking_odl/db/db.py#L205","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            return False"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def execute_ops(self):"},{"line_number":107,"context_line":"        LOG.info(\"Starting periodic task.\")"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        # Lock make sure that periodic task is executed only after"},{"line_number":110,"context_line":"        # specified interval. It makes sure that maintenance tasks"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f32af529","line":107,"range":{"start_line":107,"start_character":0,"end_line":107,"end_character":43},"updated":"2017-07-05 07:08:09.000000000","message":"Would make sense to print the task name as well.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":118,"context_line":"        if not db.lock_periodic_task(db_session, self.task):"},{"line_number":119,"context_line":"            LOG.info(\"Periodic %s task already running. Moving to next \""},{"line_number":120,"context_line":"                     \"task\", self.task)"},{"line_number":121,"context_line":"            return"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_d3d13925","line":120,"range":{"start_line":119,"start_character":56,"end_line":120,"end_character":26},"updated":"2017-07-05 07:08:09.000000000","message":"Inaccurate, should be omitted","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":128,"context_line":"                                    operation\u003dNone)"},{"line_number":129,"context_line":"            db.unlock_periodic_task(db_session, self.task)"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"        LOG.debug(\"%s task has been finished\", self.task)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"    def register_operation(self, phase):"},{"line_number":134,"context_line":"        \"\"\"Register a function to be run by the periodic task."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_93198123","line":131,"range":{"start_line":131,"start_character":0,"end_line":131,"end_character":57},"updated":"2017-07-05 07:08:09.000000000","message":"For symmetry either this should be in info, or the \"starting\" log should be in debug","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":65,"context_line":"                          op_details)"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    def task_already_executed_recently(self):"},{"line_number":68,"context_line":"        import pdb"},{"line_number":69,"context_line":"        pdb.set_trace()"},{"line_number":70,"context_line":"        db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":71,"context_line":"        row \u003d db.get_db_row_lock_updated_before_interval(db_session, self.task,"},{"line_number":72,"context_line":"                                                         self.interval)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_048eb726","line":69,"range":{"start_line":68,"start_character":8,"end_line":69,"end_character":23},"updated":"2017-07-10 12:23:15.000000000","message":"Leftovers :)","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        import pdb"},{"line_number":69,"context_line":"        pdb.set_trace()"},{"line_number":70,"context_line":"        db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":71,"context_line":"        row \u003d db.get_db_row_lock_updated_before_interval(db_session, self.task,"},{"line_number":72,"context_line":"                                                         self.interval)"},{"line_number":73,"context_line":"        if row is None:"},{"line_number":74,"context_line":"            return True"},{"line_number":75,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_a4ea63a9","line":72,"range":{"start_line":71,"start_character":14,"end_line":72,"end_character":71},"updated":"2017-07-10 12:23:15.000000000","message":"Slight alteration here can make the code much clearer, make this method return a boolean and then you can just \u0027return\u0027 it..\n\nObviously the name would need to be something like \u0027was_periodic_task_executed_recently\u0027","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        # Lock make sure that periodic task is executed only after"},{"line_number":81,"context_line":"        # specified interval. It makes sure that maintenance tasks"},{"line_number":82,"context_line":"        # are not executed back to back."},{"line_number":83,"context_line":"        db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":84,"context_line":"        if self.task_already_executed_recently():"},{"line_number":85,"context_line":"            LOG.info(\"Periodic %s task executed after periodic interval \""},{"line_number":86,"context_line":"                     \"Skipping execution.\", self.task)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_0405977a","line":83,"range":{"start_line":83,"start_character":0,"end_line":83,"end_character":56},"updated":"2017-07-10 12:23:15.000000000","message":"Makes no sense to put before this \u0027if\u0027 you\u0027re not using this session here (nor should you).","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":98,"context_line":"                                    operation\u003dNone)"},{"line_number":99,"context_line":"            db.unlock_periodic_task(db_session, self.task)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        LOG.debug(\"%s task has been finished\", self.task)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def register_operation(self, phase):"},{"line_number":104,"context_line":"        \"\"\"Register a function to be run by the periodic task."}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_e42e1bf9","line":101,"range":{"start_line":101,"start_character":0,"end_line":101,"end_character":57},"updated":"2017-07-10 12:23:15.000000000","message":"You missed my previous comment:\n\nFor symmetry either this should be in info, or the \"starting\" log should be in debug","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":70,"context_line":"                                                      self.interval)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def execute_ops(self):"},{"line_number":73,"context_line":"        LOG.info(\"Starting %s periodic task.\", self.task)"},{"line_number":74,"context_line":"        # Lock make sure that periodic task is executed only after"},{"line_number":75,"context_line":"        # specified interval. It makes sure that maintenance tasks"},{"line_number":76,"context_line":"        # are not executed back to back."},{"line_number":77,"context_line":"        if self.task_already_executed_recently():"},{"line_number":78,"context_line":"            LOG.info(\"Periodic %s task executed after periodic interval \""},{"line_number":79,"context_line":"                     \"Skipping execution.\", self.task)"},{"line_number":80,"context_line":"            return"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"        db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":83,"context_line":"        if not db.lock_periodic_task(db_session, self.task):"},{"line_number":84,"context_line":"            LOG.info(\"Periodic %s task already running task\", self.task)"},{"line_number":85,"context_line":"            return"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"        try:"},{"line_number":88,"context_line":"            for phase in self.phases:"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_a286c264","line":85,"range":{"start_line":73,"start_character":0,"end_line":85,"end_character":18},"updated":"2017-07-10 21:23:50.000000000","message":"It would be better to take the lock if it\u0027s not run recently.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":70,"context_line":"                                                      self.interval)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def execute_ops(self):"},{"line_number":73,"context_line":"        LOG.info(\"Starting %s periodic task.\", self.task)"},{"line_number":74,"context_line":"        # Lock make sure that periodic task is executed only after"},{"line_number":75,"context_line":"        # specified interval. It makes sure that maintenance tasks"},{"line_number":76,"context_line":"        # are not executed back to back."},{"line_number":77,"context_line":"        if self.task_already_executed_recently():"},{"line_number":78,"context_line":"            LOG.info(\"Periodic %s task executed after periodic interval \""},{"line_number":79,"context_line":"                     \"Skipping execution.\", self.task)"},{"line_number":80,"context_line":"            return"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"        db_session \u003d neutron_db_api.get_writer_session()"},{"line_number":83,"context_line":"        if not db.lock_periodic_task(db_session, self.task):"},{"line_number":84,"context_line":"            LOG.info(\"Periodic %s task already running task\", self.task)"},{"line_number":85,"context_line":"            return"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"        try:"},{"line_number":88,"context_line":"            for phase in self.phases:"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_dcd2ba34","line":85,"range":{"start_line":73,"start_character":0,"end_line":85,"end_character":18},"in_reply_to":"3f1d235d_a286c264","updated":"2017-07-12 07:20:03.000000000","message":"We are taking lock in L83.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/ml2/mech_driver_v2.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        cleanup_obj \u003d cleanup.JournalCleanup()"},{"line_number":72,"context_line":"        self._periodic_task \u003d periodic_task.PeriodicTask()"},{"line_number":73,"context_line":"        self._periodic_task.register_operation("},{"line_number":74,"context_line":"            \u0027maintenance\u0027,"},{"line_number":75,"context_line":"            cleanup_obj.delete_completed_rows)"},{"line_number":76,"context_line":"        self._periodic_task.register_operation("},{"line_number":77,"context_line":"            \u0027maintenance\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_98339962","line":74,"range":{"start_line":74,"start_character":12,"end_line":74,"end_character":25},"updated":"2017-06-18 12:09:58.000000000","message":"Wasn\u0027t the whole idea to parallelize?\nShouldn\u0027t they all we on different \"task\"?","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        cleanup_obj \u003d cleanup.JournalCleanup()"},{"line_number":72,"context_line":"        self._periodic_task \u003d periodic_task.PeriodicTask()"},{"line_number":73,"context_line":"        self._periodic_task.register_operation("},{"line_number":74,"context_line":"            \u0027maintenance\u0027,"},{"line_number":75,"context_line":"            cleanup_obj.delete_completed_rows)"},{"line_number":76,"context_line":"        self._periodic_task.register_operation("},{"line_number":77,"context_line":"            \u0027maintenance\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_b9ebf410","line":74,"range":{"start_line":74,"start_character":12,"end_line":74,"end_character":25},"in_reply_to":"7f231b9d_98339962","updated":"2017-06-19 05:06:28.000000000","message":"The idea is, there can be tasks and each task might be doing different things, called phases. Lock has to be acquired on a tasks and all the phases in that task are to be executed. and then apply lock on other task and execute all the phases defined in that task.\n\nAll these operations has been put under maintenance task with different phase name. So i think, it is correct?","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":65,"context_line":"    def get_workers(self):"},{"line_number":66,"context_line":"        return [port_status_update.OdlPortStatusUpdate()]"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def _start_periodic_tasks(self):"},{"line_number":69,"context_line":"        # start the periodic tasks and register all the tasks"},{"line_number":70,"context_line":"        # operations :"},{"line_number":71,"context_line":"        # (1) JournalCleanup - Delete completed rows from journal"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_b3111d55","line":68,"range":{"start_line":68,"start_character":24,"end_line":68,"end_character":29},"updated":"2017-07-05 07:08:09.000000000","message":"nit: task","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":66,"context_line":"        return [port_status_update.OdlPortStatusUpdate()]"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def _start_periodic_tasks(self):"},{"line_number":69,"context_line":"        # start the periodic tasks and register all the tasks"},{"line_number":70,"context_line":"        # operations :"},{"line_number":71,"context_line":"        # (1) JournalCleanup - Delete completed rows from journal"},{"line_number":72,"context_line":"        # (2) CleanupProcessing - Mark orphaned processing rows to pending"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_d3149946","line":69,"range":{"start_line":69,"start_character":56,"end_line":69,"end_character":61},"updated":"2017-07-05 07:08:09.000000000","message":"nit: phases","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":66,"context_line":"        return [port_status_update.OdlPortStatusUpdate()]"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def _start_periodic_tasks(self):"},{"line_number":69,"context_line":"        # start the periodic tasks and register all the tasks"},{"line_number":70,"context_line":"        # operations :"},{"line_number":71,"context_line":"        # (1) JournalCleanup - Delete completed rows from journal"},{"line_number":72,"context_line":"        # (2) CleanupProcessing - Mark orphaned processing rows to pending"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f30b1521","line":69,"range":{"start_line":69,"start_character":29,"end_line":69,"end_character":34},"updated":"2017-07-05 07:08:09.000000000","message":"nit: task","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"87c1a132d7f56dabdeabaf03f1a87283d58503d3","unresolved":false,"context_lines":[{"line_number":66,"context_line":"        return [port_status_update.OdlPortStatusUpdate()]"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def _start_periodic_task(self):"},{"line_number":69,"context_line":"        # start the periodic phases and register all the task"},{"line_number":70,"context_line":"        # operations :"},{"line_number":71,"context_line":"        # (1) JournalCleanup - Delete completed rows from journal"},{"line_number":72,"context_line":"        # (2) CleanupProcessing - Mark orphaned processing rows to pending"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_a4bb8370","line":69,"range":{"start_line":69,"start_character":0,"end_line":69,"end_character":61},"updated":"2017-07-10 12:23:15.000000000","message":"You got me previous comment wrong, anyway this should be:\n\n        # start the periodic task and register all the phases","commit_id":"b3ccb48d8b3fffcce73eb28596c15797b2b1e570"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        self.trunk_driver \u003d trunk_driver.OpenDaylightTrunkDriverV2.create()"},{"line_number":60,"context_line":"        if odl_const.ODL_QOS in cfg.CONF.ml2.extension_drivers:"},{"line_number":61,"context_line":"            qos_driver.OpenDaylightQosDriver.create()"},{"line_number":62,"context_line":"        self._start_periodic_task()"},{"line_number":63,"context_line":"        odl_features.init()"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def get_workers(self):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_e2e03a29","line":62,"range":{"start_line":62,"start_character":8,"end_line":62,"end_character":35},"updated":"2017-07-10 21:23:50.000000000","message":"this means all periodic tasks are run by all worker processes and main process.\nMaybe we can make it neutron worker.\nIt should be done by another patch, though.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        self.trunk_driver \u003d trunk_driver.OpenDaylightTrunkDriverV2.create()"},{"line_number":60,"context_line":"        if odl_const.ODL_QOS in cfg.CONF.ml2.extension_drivers:"},{"line_number":61,"context_line":"            qos_driver.OpenDaylightQosDriver.create()"},{"line_number":62,"context_line":"        self._start_periodic_task()"},{"line_number":63,"context_line":"        odl_features.init()"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def get_workers(self):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_dcbbdae2","line":62,"range":{"start_line":62,"start_character":8,"end_line":62,"end_character":35},"in_reply_to":"3f1d235d_e2e03a29","updated":"2017-07-12 07:20:03.000000000","message":"OK, i will do in separate patch. What happens if parent process die, how should we handle that case?","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/ml2/pseudo_agentdb_binding.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        else:"},{"line_number":82,"context_line":"            # Start polling ODL restconf using periodic task."},{"line_number":83,"context_line":"            # default: 30s (should be \u003c\u003d  agent keep-alive poll interval)"},{"line_number":84,"context_line":"            self._start_periodic_task()"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def _make_hostconf_uri(self, odl_url\u003dNone, path\u003d\u0027\u0027):"},{"line_number":87,"context_line":"        \"\"\"Make ODL hostconfigs URI with host/port extraced from ODL_URL.\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_3825a509","line":84,"range":{"start_line":84,"start_character":12,"end_line":84,"end_character":39},"updated":"2017-06-18 12:09:58.000000000","message":"The interval was intentionally exposed here in order to run at a different interval, you should probably put it back.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":81,"context_line":"        else:"},{"line_number":82,"context_line":"            # Start polling ODL restconf using periodic task."},{"line_number":83,"context_line":"            # default: 30s (should be \u003c\u003d  agent keep-alive poll interval)"},{"line_number":84,"context_line":"            self._start_periodic_task()"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def _make_hostconf_uri(self, odl_url\u003dNone, path\u003d\u0027\u0027):"},{"line_number":87,"context_line":"        \"\"\"Make ODL hostconfigs URI with host/port extraced from ODL_URL.\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_793f9c86","line":84,"range":{"start_line":84,"start_character":12,"end_line":84,"end_character":39},"in_reply_to":"7f231b9d_3825a509","updated":"2017-06-19 05:06:28.000000000","message":"As per current implementation, Periodic class is singleton therefor it is being executed only by one thread, so putting different interval for different task is not possible.\n\nHowever if we want to achieve the same then we can create instance of that class per task not per phase. Therefore all the phase in a task can be executed as per specified interval.\n\nIf more finer control has to be acquired over each phase then we will have to acquire lock on per task and phase basis and it will leads to creation of lock row for each phase. If we go by this approach then we can leave the idea of phase and task and use only phases as tasks.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":32,"context_line":"from networking_odl.common import odl_features"},{"line_number":33,"context_line":"from networking_odl.common import utils"},{"line_number":34,"context_line":"from networking_odl.common import websocket_client as odl_ws_client"},{"line_number":35,"context_line":"from networking_odl.journal import periodic_task as pt"},{"line_number":36,"context_line":"from networking_odl.ml2 import port_binding"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"cfg.CONF.import_group(\u0027ml2_odl\u0027, \u0027networking_odl.common.config\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_d33db9c4","line":35,"range":{"start_line":35,"start_character":49,"end_line":35,"end_character":54},"updated":"2017-07-05 07:08:09.000000000","message":"nit: I don\u0027t think it adds any value to abbreviate the import.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        return urlparse.urlunparse((purl.scheme, purl.netloc,"},{"line_number":97,"context_line":"                                    path, \u0027\u0027, \u0027\u0027, \u0027\u0027))"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    def _start_periodic_task(self, poll_interval):"},{"line_number":100,"context_line":"        self._periodic \u003d periodic_task.PeriodicTask(\u0027hostconfig_update\u0027,"},{"line_number":101,"context_line":"                                                    poll_interval)"},{"line_number":102,"context_line":"        self._periodic.register_operation(self._get_and_update_hostconfigs)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_82cbc6a3","line":99,"range":{"start_line":99,"start_character":8,"end_line":99,"end_character":28},"updated":"2017-07-10 21:23:50.000000000","message":"This should be neutron worker too.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        return urlparse.urlunparse((purl.scheme, purl.netloc,"},{"line_number":97,"context_line":"                                    path, \u0027\u0027, \u0027\u0027, \u0027\u0027))"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    def _start_periodic_task(self, poll_interval):"},{"line_number":100,"context_line":"        self._periodic \u003d periodic_task.PeriodicTask(\u0027hostconfig_update\u0027,"},{"line_number":101,"context_line":"                                                    poll_interval)"},{"line_number":102,"context_line":"        self._periodic.register_operation(self._get_and_update_hostconfigs)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_3ccace6d","line":99,"range":{"start_line":99,"start_character":8,"end_line":99,"end_character":28},"in_reply_to":"3f1d235d_82cbc6a3","updated":"2017-07-12 07:20:03.000000000","message":"Ok, i will do it in separate patch.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/tests/unit/base_v2.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":38,"context_line":"        self.mock_sync_thread \u003d mock.patch.object("},{"line_number":39,"context_line":"            journal.OpendaylightJournalThread, \u0027start_odl_sync_thread\u0027).start()"},{"line_number":40,"context_line":"        self.mock_pt_thread \u003d mock.patch.object("},{"line_number":41,"context_line":"            loopingcall.FixedIntervalLoopingCall, \u0027start\u0027).start()"},{"line_number":42,"context_line":"        self.thread \u003d journal.OpendaylightJournalThread()"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    def run_journal_processing(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_135a1182","line":41,"range":{"start_line":41,"start_character":12,"end_line":41,"end_character":48},"updated":"2017-07-05 07:08:09.000000000","message":"You should be mocking the task class, otherwise you\u0027re coupling the test code to the internal implemntation which might change","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"}],"networking_odl/tests/unit/db/test_db.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"7f231b9d_d87b51f2","updated":"2017-06-18 12:09:58.000000000","message":"You should add tests to cover the logic you added i.e that if you have several \"lock rows\" the correct one gets locked/unlocked etc..","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"7f231b9d_b90774ca","in_reply_to":"7f231b9d_d87b51f2","updated":"2017-06-19 05:06:28.000000000","message":"OK, i will add in next patch.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":9,"id":"3f1d235d_62430a15","updated":"2017-07-10 21:23:50.000000000","message":"we\u0027d like to have a test case if task was run recently.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/tests/unit/journal/test_periodic_task.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"3f272bc830c3133f8830b1f7ed791a2e5ca171d7","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        with mock.patch.object(periodic_task, \u0027LOG\u0027) as mock_log:"},{"line_number":42,"context_line":"            operation \u003d mock.MagicMock()"},{"line_number":43,"context_line":"            operation.__name__ \u003d \"test\""},{"line_number":44,"context_line":"            self.thread.register_operation(\u0027maintenance\u0027, operation)"},{"line_number":45,"context_line":"            self.thread._execute_op(\u0027maintenance\u0027, operation)"},{"line_number":46,"context_line":"            self.assertTrue(operation.called)"},{"line_number":47,"context_line":"            self.assertTrue(mock_log.info.called)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_187549fa","line":44,"range":{"start_line":44,"start_character":43,"end_line":44,"end_character":56},"updated":"2017-06-18 12:09:58.000000000","message":"Since the DB code is already tested elsewhere and you don\u0027t want to rely on any real value that might or might now exist I suggest to mock out the DB interactions where necessary and use a \"gibberish\" or random task name.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"2b8f29b91308c03edc50bc9eea6e7b6f8b8607ee","unresolved":false,"context_lines":[{"line_number":41,"context_line":"        with mock.patch.object(periodic_task, \u0027LOG\u0027) as mock_log:"},{"line_number":42,"context_line":"            operation \u003d mock.MagicMock()"},{"line_number":43,"context_line":"            operation.__name__ \u003d \"test\""},{"line_number":44,"context_line":"            self.thread.register_operation(\u0027maintenance\u0027, operation)"},{"line_number":45,"context_line":"            self.thread._execute_op(\u0027maintenance\u0027, operation)"},{"line_number":46,"context_line":"            self.assertTrue(operation.called)"},{"line_number":47,"context_line":"            self.assertTrue(mock_log.info.called)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7f231b9d_f96bac81","line":44,"range":{"start_line":44,"start_character":43,"end_line":44,"end_character":56},"in_reply_to":"7f231b9d_187549fa","updated":"2017-06-19 05:06:28.000000000","message":"We can use any random value, it will get registered first time. I will fix it, i think db interaction is also ok.","commit_id":"da64fbecabd6f47b2473f3f070f8f8f4a391cc4f"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":25,"context_line":"class PeriodicTaskThreadTestCase(test_base_db.ODLBaseDbTestCase):"},{"line_number":26,"context_line":"    def setUp(self):"},{"line_number":27,"context_line":"        super(PeriodicTaskThreadTestCase, self).setUp()"},{"line_number":28,"context_line":"        periodic_task.PeriodicTask.tasks \u003d {}"},{"line_number":29,"context_line":"        self.thread \u003d periodic_task.PeriodicTask(\u0027test_maintenance_task\u0027)"},{"line_number":30,"context_line":"        self.thread.interval \u003d 0.01"},{"line_number":31,"context_line":"        self.addCleanup(self.thread.cleanup)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_73df05d6","line":28,"range":{"start_line":28,"start_character":8,"end_line":28,"end_character":45},"updated":"2017-07-05 07:08:09.000000000","message":"This seems unnecessary","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        # Make sure the callback event was called and not timed out"},{"line_number":86,"context_line":"        self.assertTrue(callback_event.wait(timeout\u003d5))"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    def test_multiple_thread_works(self):"},{"line_number":89,"context_line":"        self.thread1 \u003d periodic_task.PeriodicTask(\u0027R__AN_DOM_TASK_S\u0027)"},{"line_number":90,"context_line":"        self.thread2 \u003d periodic_task.PeriodicTask(\u0027RANDOMtasks\u0027)"},{"line_number":91,"context_line":"        count \u003d [0, 0, 0]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_b3759dcd","line":88,"range":{"start_line":88,"start_character":22,"end_line":88,"end_character":34},"updated":"2017-07-05 07:08:09.000000000","message":"nit: threads_work","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    def test_multiple_thread_works(self):"},{"line_number":89,"context_line":"        self.thread1 \u003d periodic_task.PeriodicTask(\u0027R__AN_DOM_TASK_S\u0027)"},{"line_number":90,"context_line":"        self.thread2 \u003d periodic_task.PeriodicTask(\u0027RANDOMtasks\u0027)"},{"line_number":91,"context_line":"        count \u003d [0, 0, 0]"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        def callback_op1(**kwargs):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_7354a521","line":90,"range":{"start_line":90,"start_character":8,"end_line":90,"end_character":64},"updated":"2017-07-05 07:08:09.000000000","message":"This is unnecessary, one additional thread already achieves this","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        def callback_op2(**kwargs):"},{"line_number":97,"context_line":"            count[1] +\u003d 1"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"        def callback_op3(**kwargs):"},{"line_number":100,"context_line":"            count[2] +\u003d 1"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"        self.thread.register_operation(callback_op1)"},{"line_number":103,"context_line":"        self.thread.register_operation(callback_op2)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_1339f1f0","line":100,"range":{"start_line":98,"start_character":0,"end_line":100,"end_character":25},"updated":"2017-07-05 07:08:09.000000000","message":"Unnecessary","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":100,"context_line":"            count[2] +\u003d 1"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"        self.thread.register_operation(callback_op1)"},{"line_number":103,"context_line":"        self.thread.register_operation(callback_op2)"},{"line_number":104,"context_line":"        self.thread.register_operation(callback_op3)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        self.thread.start()"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f33d55dd","line":103,"range":{"start_line":103,"start_character":8,"end_line":103,"end_character":52},"updated":"2017-07-05 07:08:09.000000000","message":"Shouldn\u0027t this be registered to thread1?","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        self.thread1.start()"},{"line_number":108,"context_line":"        self.thread2.start()"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        time.sleep(1)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        self.assertGreater(count[0], 0)"},{"line_number":113,"context_line":"        self.assertGreater(count[1], 0)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_d30ff934","line":110,"range":{"start_line":110,"start_character":8,"end_line":110,"end_character":21},"updated":"2017-07-05 07:08:09.000000000","message":"Better to use the callback event mechanism than arbitrary sleep","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        for _ in range(3):"},{"line_number":129,"context_line":"            self.assertFalse(count[0])"},{"line_number":130,"context_line":"            time.sleep(1)"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        time.sleep(4)"},{"line_number":133,"context_line":"        self.assertTrue(count[0])"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"    def test_lock_less_than_interval(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_b63fcbb2","line":132,"range":{"start_line":130,"start_character":0,"end_line":132,"end_character":21},"updated":"2017-07-05 07:08:09.000000000","message":"Arbitrary sleeps are a bad way to write even test code, you need to think of something better.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":132,"context_line":"        time.sleep(4)"},{"line_number":133,"context_line":"        self.assertTrue(count[0])"},{"line_number":134,"context_line":""},{"line_number":135,"context_line":"    def test_lock_less_than_interval(self):"},{"line_number":136,"context_line":"        count \u003d [False]"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":"        def callback_op(**kwargs):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f680a348","line":135,"range":{"start_line":135,"start_character":4,"end_line":135,"end_character":43},"updated":"2017-07-05 07:08:09.000000000","message":"This test can be much simpler if you simply update the task in the DB and then capture the log and see that the task is skipped.\n\nOr if you mock the DB interaction here then you can arbitrarily return what you want and assert that for instance nothing happened.","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        self.assertTrue(callback_event1.wait(timeout\u003d5))"},{"line_number":119,"context_line":"        self.thread1.cleanup()"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    @mock.patch.object(db, \"was_periodic_task_executed_recently\")"},{"line_number":122,"context_line":"    def test_back_to_back_job(self, mock_status_method):"},{"line_number":123,"context_line":"        callback_event \u003d threading.Event()"},{"line_number":124,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_025456c9","line":121,"range":{"start_line":121,"start_character":3,"end_line":121,"end_character":65},"updated":"2017-07-10 21:23:50.000000000","message":"Oh, we have one.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"2cb34334e2622dd5ccc9952e17f2c0574708f4f8","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        self.assertTrue(callback_event.wait(timeout\u003d5))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def test_multiple_thread_work(self):"},{"line_number":101,"context_line":"        self.thread1 \u003d periodic_task.PeriodicTask(\u0027R__AN_DOM_TASK_S\u0027)"},{"line_number":102,"context_line":"        callback_event \u003d threading.Event()"},{"line_number":103,"context_line":"        callback_event1 \u003d threading.Event()"},{"line_number":104,"context_line":"        self.thread1.interval \u003d 0.01"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1a1f67_a0dab874","line":101,"range":{"start_line":101,"start_character":51,"end_line":101,"end_character":67},"updated":"2017-07-18 17:27:19.000000000","message":"Although I don\u0027t care much about random name for test, please make it meaningful name.\nmaybe just a matter of taste.","commit_id":"7623f4e2c5aee0bd573e2ab72281a3908ed9d3f9"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"2cb34334e2622dd5ccc9952e17f2c0574708f4f8","unresolved":false,"context_lines":[{"line_number":103,"context_line":"        callback_event1 \u003d threading.Event()"},{"line_number":104,"context_line":"        self.thread1.interval \u003d 0.01"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"        def callback_op1(**kwargs):"},{"line_number":107,"context_line":"            callback_event.set()"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        def callback_op2(**kwargs):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1a1f67_e042f00e","line":106,"range":{"start_line":106,"start_character":23,"end_line":106,"end_character":24},"updated":"2017-07-18 17:27:19.000000000","message":"Please use no prefix vs 1(or 1 vs 2) consistently.","commit_id":"7623f4e2c5aee0bd573e2ab72281a3908ed9d3f9"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"2cb34334e2622dd5ccc9952e17f2c0574708f4f8","unresolved":false,"context_lines":[{"line_number":117,"context_line":""},{"line_number":118,"context_line":"        self.assertTrue(callback_event.wait(timeout\u003d5))"},{"line_number":119,"context_line":"        self.assertTrue(callback_event1.wait(timeout\u003d5))"},{"line_number":120,"context_line":"        self.thread1.cleanup()"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    @mock.patch.object(db, \"was_periodic_task_executed_recently\")"},{"line_number":123,"context_line":"    def test_back_to_back_job(self, mock_status_method):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1a1f67_c0fb74be","line":120,"range":{"start_line":120,"start_character":8,"end_line":120,"end_character":30},"updated":"2017-07-18 17:27:19.000000000","message":"please use addCleanup()","commit_id":"7623f4e2c5aee0bd573e2ab72281a3908ed9d3f9"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"2cb34334e2622dd5ccc9952e17f2c0574708f4f8","unresolved":false,"context_lines":[{"line_number":131,"context_line":"               \"interval Skipping execution.\")"},{"line_number":132,"context_line":"        with mock.patch.object(periodic_task.LOG, \u0027info\u0027) as mock_log_info:"},{"line_number":133,"context_line":"            mock_status_method.return_value \u003d True"},{"line_number":134,"context_line":"            self.thread.start()"},{"line_number":135,"context_line":"            time.sleep(1)"},{"line_number":136,"context_line":"            mock_log_info.assert_called_with(msg, \u0027test-maintenance\u0027)"},{"line_number":137,"context_line":"            self.assertFalse(callback_event.wait(timeout\u003d1))"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1a1f67_00272c66","line":134,"range":{"start_line":134,"start_character":24,"end_line":134,"end_character":31},"updated":"2017-07-18 17:27:19.000000000","message":"cleanup is necessary.","commit_id":"7623f4e2c5aee0bd573e2ab72281a3908ed9d3f9"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"cb29dbaac68623bd3b2ec64ae4ccf316db8d0727","unresolved":false,"context_lines":[{"line_number":47,"context_line":"            self.thread.register_operation(operation)"},{"line_number":48,"context_line":"            db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":49,"context_line":"            self.thread._execute_op(operation, db_session)"},{"line_number":50,"context_line":"            self.assertTrue(operation.called)"},{"line_number":51,"context_line":"            self.assertTrue(mock_log.info.called)"},{"line_number":52,"context_line":"            self.assertFalse(mock_log.exception.called)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def test__execute_op_with_exception(self):"},{"line_number":55,"context_line":"        with mock.patch.object(periodic_task, \u0027LOG\u0027) as mock_log:"}],"source_content_type":"text/x-python","patch_set":15,"id":"1f1a1f67_5a3edfda","line":52,"range":{"start_line":50,"start_character":0,"end_line":52,"end_character":55},"updated":"2017-07-20 15:55:38.000000000","message":"mock.assert_called()","commit_id":"27d59d019005622aca708905ff72394d5587454d"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"cb29dbaac68623bd3b2ec64ae4ccf316db8d0727","unresolved":false,"context_lines":[{"line_number":57,"context_line":"            operation.__name__ \u003d \"test\""},{"line_number":58,"context_line":"            db_session \u003d neutron_db_api.get_reader_session()"},{"line_number":59,"context_line":"            self.thread._execute_op(operation, db_session)"},{"line_number":60,"context_line":"            self.assertTrue(mock_log.exception.called)"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def test_thread_works(self):"},{"line_number":63,"context_line":"        callback_event \u003d threading.Event()"}],"source_content_type":"text/x-python","patch_set":15,"id":"1f1a1f67_ba185384","line":60,"range":{"start_line":60,"start_character":0,"end_line":60,"end_character":54},"updated":"2017-07-20 15:55:38.000000000","message":"mock_log.exception.assert_called()","commit_id":"27d59d019005622aca708905ff72394d5587454d"}],"networking_odl/tests/unit/l3/test_l3_odl_v2.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        mock.patch.object(journal.OpendaylightJournalThread,"},{"line_number":115,"context_line":"                          \u0027start_odl_sync_thread\u0027).start()"},{"line_number":116,"context_line":"        self.mock_mt_thread \u003d mock.patch.object("},{"line_number":117,"context_line":"            loopingcall.FixedIntervalLoopingCall, \u0027start\u0027).start()"},{"line_number":118,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"},{"line_number":119,"context_line":"                          \u0027_record_in_journal\u0027).start()"},{"line_number":120,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_f35e7574","line":117,"range":{"start_line":117,"start_character":12,"end_line":117,"end_character":48},"updated":"2017-07-05 07:08:09.000000000","message":"You should be mocking the task class, otherwise you\u0027re coupling the test code to the internal implemntation which might change","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"9cea22a1ab232e8cb6af2416d883b64d660a6ff7","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        service_plugins \u003d {\u0027l3_plugin_name\u0027: \u0027odl-router_v2\u0027}"},{"line_number":114,"context_line":"        mock.patch.object(journal.OpenDaylightJournalThread,"},{"line_number":115,"context_line":"                          \u0027start_odl_sync_thread\u0027).start()"},{"line_number":116,"context_line":"        self.mock_mt_thread \u003d mock.patch.object("},{"line_number":117,"context_line":"            periodic_task.PeriodicTask, \u0027start\u0027).start()"},{"line_number":118,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"},{"line_number":119,"context_line":"                          \u0027_record_in_journal\u0027).start()"},{"line_number":120,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_026d7697","line":117,"range":{"start_line":116,"start_character":0,"end_line":117,"end_character":56},"updated":"2017-07-10 21:23:50.000000000","message":"Let\u0027s introduce fixture instead of fixing up everywhere.","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"},{"author":{"_account_id":13912,"name":"rajiv","email":"thenakliman@gmail.com","username":"rajiv.kumar"},"change_message_id":"fabd36a001775a10b3357a166215b4dab96a69ca","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        service_plugins \u003d {\u0027l3_plugin_name\u0027: \u0027odl-router_v2\u0027}"},{"line_number":114,"context_line":"        mock.patch.object(journal.OpenDaylightJournalThread,"},{"line_number":115,"context_line":"                          \u0027start_odl_sync_thread\u0027).start()"},{"line_number":116,"context_line":"        self.mock_mt_thread \u003d mock.patch.object("},{"line_number":117,"context_line":"            periodic_task.PeriodicTask, \u0027start\u0027).start()"},{"line_number":118,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"},{"line_number":119,"context_line":"                          \u0027_record_in_journal\u0027).start()"},{"line_number":120,"context_line":"        mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_6177563c","line":117,"range":{"start_line":116,"start_character":0,"end_line":117,"end_character":56},"in_reply_to":"3f1d235d_026d7697","updated":"2017-07-12 07:20:03.000000000","message":"Done","commit_id":"e548923de296c2195ae7d1b93c60993b505525d6"}],"networking_odl/tests/unit/ml2/test_mechanism_odl_v2.py":[{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"e3029f562973122d2bc160b2fe2f08b4d7593668","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        self.mock_sync_thread \u003d mock.patch.object("},{"line_number":63,"context_line":"            journal.OpendaylightJournalThread, \u0027start_odl_sync_thread\u0027).start()"},{"line_number":64,"context_line":"        self.mock_mt_thread \u003d mock.patch.object("},{"line_number":65,"context_line":"            loopingcall.FixedIntervalLoopingCall, \u0027start\u0027).start()"},{"line_number":66,"context_line":"        cfg.CONF.set_override(\u0027mechanism_drivers\u0027,"},{"line_number":67,"context_line":"                              [\u0027logger\u0027, \u0027opendaylight_v2\u0027], \u0027ml2\u0027)"},{"line_number":68,"context_line":"        cfg.CONF.set_override(\u0027port_binding_controller\u0027,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_934d01c6","line":65,"range":{"start_line":65,"start_character":12,"end_line":65,"end_character":48},"updated":"2017-07-05 07:08:09.000000000","message":"You should be mocking the task class, otherwise you\u0027re coupling the test code to the internal implemntation which might change","commit_id":"daa17c1c6fb5b7d5e5246292073b0c2f733f7541"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"2cb34334e2622dd5ccc9952e17f2c0574708f4f8","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"class OpenDayLightMechanismConfigTests("},{"line_number":60,"context_line":"        testlib_api.SqlTestCase,"},{"line_number":61,"context_line":"        odl_base.OpenDaylightPeriodicTaskFixture):"},{"line_number":62,"context_line":""},{"line_number":63,"context_line":"    def setUp(self):"},{"line_number":64,"context_line":"        super(OpenDayLightMechanismConfigTests, self).setUp()"}],"source_content_type":"text/x-python","patch_set":13,"id":"1f1a1f67_c097f447","line":61,"range":{"start_line":61,"start_character":8,"end_line":61,"end_character":48},"updated":"2017-07-18 17:27:19.000000000","message":"useFixuture()","commit_id":"7623f4e2c5aee0bd573e2ab72281a3908ed9d3f9"}]}
