)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Limit the number of finished executions."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A new option was intorduced to execution_expiration_policy to limit"},{"line_number":10,"context_line":"the amount of finished and not expired executions. This can be used"},{"line_number":11,"context_line":"keep the number of finished executions under a limit, even if a"},{"line_number":12,"context_line":"huge number of executions are created in a short period of time."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"dfeb2761_2fa7fe51","line":10,"range":{"start_line":10,"start_character":63,"end_line":10,"end_character":67},"updated":"2017-04-04 09:17:26.000000000","message":"used -\u003e used to","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Limit the number of finished executions."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"A new option was intorduced to execution_expiration_policy to limit"},{"line_number":10,"context_line":"the amount of finished and not expired executions. This can be used"},{"line_number":11,"context_line":"keep the number of finished executions under a limit, even if a"},{"line_number":12,"context_line":"huge number of executions are created in a short period of time."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"bff0334d_d7adac9b","line":10,"range":{"start_line":10,"start_character":63,"end_line":10,"end_character":67},"in_reply_to":"dfeb2761_2fa7fe51","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"}],"mistral/config.py":[{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"ec0ee0c217ef2b0ab296c820ede8d1e9599e5b70","unresolved":false,"context_lines":[{"line_number":225,"context_line":"               \u0027Minimum value is 1. \u0027)"},{"line_number":226,"context_line":"    ),"},{"line_number":227,"context_line":"    cfg.IntOpt("},{"line_number":228,"context_line":"        \u0027max_finished_executions\u0027,"},{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_1e95ac40","line":228,"range":{"start_line":228,"start_character":9,"end_line":228,"end_character":32},"updated":"2017-03-27 09:08:40.000000000","message":"From the help message,  \u0027max_executions_reserved\u0027 sounds better","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"5efa5cbf27899c5dc6917c280cfe93edce3f01b7","unresolved":false,"context_lines":[{"line_number":225,"context_line":"               \u0027Minimum value is 1. \u0027)"},{"line_number":226,"context_line":"    ),"},{"line_number":227,"context_line":"    cfg.IntOpt("},{"line_number":228,"context_line":"        \u0027max_finished_executions\u0027,"},{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_80814b92","line":228,"range":{"start_line":228,"start_character":9,"end_line":228,"end_character":32},"in_reply_to":"ffe62b97_1e95ac40","updated":"2017-03-27 12:52:10.000000000","message":"I thought about the name of this parameter for quite a long time, and actually this name is the result of a previous renaming. For me your suggestion sounds a bit weird, and I guess you meant max_executions_preserved. But still, that name does not imply that only the finished executions are limited.","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"9e9e399a5bb624c3133ae7822739e2a839c3bb8f","unresolved":false,"context_lines":[{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027The default value is 0. If it is set to 0,\u0027"},{"line_number":234,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    ),"},{"line_number":237,"context_line":"    cfg.IntOpt("},{"line_number":238,"context_line":"        \u0027batch_size\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_e13da08f","line":235,"updated":"2017-03-27 22:08:30.000000000","message":"I am still trying to understand this option. Do you mean we only keep max_finished_executions number of completed executions and delete all others even if some of them are not expired?","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c3868d450ade9719cdd4ad9fff01b22655b83651","unresolved":false,"context_lines":[{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027The default value is 0. If it is set to 0,\u0027"},{"line_number":234,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    ),"},{"line_number":237,"context_line":"    cfg.IntOpt("},{"line_number":238,"context_line":"        \u0027batch_size\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_09cadf9f","line":235,"in_reply_to":"ffe62b97_e13da08f","updated":"2017-03-31 19:19:47.000000000","message":"Exactly!","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"fdfa4ab5f8625e360f9b114cfb8107ef4b16734b","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027The default value is 0. If it is set to 0,\u0027"},{"line_number":234,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"},{"line_number":235,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dfeb2761_a368d520","line":232,"updated":"2017-04-03 23:30:48.000000000","message":"you should add someting like \u0027even the other executions are not expired in order to decrease the number of executions in database.\u0027 to help people understand how to use this option properly.","commit_id":"c320ee5d354791d7045ff73523c88247ed01c7fe"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"14bb3f46a5c2c24c602637d10aebdb160ac5f797","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027The default value is 0. If it is set to 0,\u0027"},{"line_number":234,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"},{"line_number":235,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dfeb2761_783713e5","line":232,"in_reply_to":"dfeb2761_a368d520","updated":"2017-04-04 07:55:14.000000000","message":"Done","commit_id":"c320ee5d354791d7045ff73523c88247ed01c7fe"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"317805924bcc16208f3fb245aca9a820d4e26435","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_02f1b16b","line":232,"range":{"start_line":232,"start_character":29,"end_line":232,"end_character":37},"updated":"2017-04-04 09:34:41.000000000","message":"s/earliest/latest?\n\nSorry for so picky about the option help message, because that\u0027s the only way for users to understand how to use that correctly :)","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        default\u003d0,"},{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_77aa6071","line":232,"range":{"start_line":232,"start_character":29,"end_line":232,"end_character":37},"in_reply_to":"dfeb2761_02f1b16b","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"},{"line_number":236,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_ef87d660","line":233,"range":{"start_line":233,"start_character":68,"end_line":233,"end_character":78},"updated":"2017-04-04 09:17:26.000000000","message":"I\u0027d change \"considered\" to \"eligible\". IMO, it would be slightly better semantically.","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"},{"line_number":236,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_0f9c3abe","line":233,"range":{"start_line":233,"start_character":37,"end_line":233,"end_character":52},"updated":"2017-04-04 09:17:26.000000000","message":"Soft: \"the\" is redundant and I\u0027d change \"the not expired\" to \"unexpired\"","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"},{"line_number":236,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_57a75ca8","line":233,"range":{"start_line":233,"start_character":37,"end_line":233,"end_character":52},"in_reply_to":"dfeb2761_0f9c3abe","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":230,"context_line":"        help\u003d_(\u0027The maximum number of finished workflow executions\u0027"},{"line_number":231,"context_line":"               \u0027to be stored. For example when max_finished_executions \u003d 100,\u0027"},{"line_number":232,"context_line":"               \u0027only the 100 earliest finished executions will be preserved.\u0027"},{"line_number":233,"context_line":"               \u0027This means that even the not expired executions are considered\u0027"},{"line_number":234,"context_line":"               \u0027for deletion, to decrease the number of executions in the\u0027"},{"line_number":235,"context_line":"               \u0027database. The default value is 0. If it is set to 0,\u0027"},{"line_number":236,"context_line":"               \u0027this constraint won\\\u0027t be applied.\u0027)"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_17bf94b0","line":233,"range":{"start_line":233,"start_character":68,"end_line":233,"end_character":78},"in_reply_to":"dfeb2761_ef87d660","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"}],"mistral/db/v2/sqlalchemy/api.py":[{"author":{"_account_id":23271,"name":"Istvan Imre","email":"istvan.imre@nokia.com","username":"istvan.imre"},"change_message_id":"9eaea2d6418720a9f1aa66dd2ede12244595d41a","unresolved":false,"context_lines":[{"line_number":1045,"context_line":"    return inverse.all()"},{"line_number":1046,"context_line":""},{"line_number":1047,"context_line":""},{"line_number":1048,"context_line":"def get_completed_root_executions(columns):"},{"line_number":1049,"context_line":"    query \u003d b.model_query(models.WorkflowExecution, columns\u003dcolumns)"},{"line_number":1050,"context_line":"    # Only WorkflowExecution that are not a child of other WorkflowExecution."},{"line_number":1051,"context_line":"    query \u003d query.filter(models.WorkflowExecution."}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_2f5dd7e9","line":1048,"updated":"2017-03-17 05:59:13.000000000","message":"It could be private because it is not published in db/v2/api.py","commit_id":"9415b98947ce315928617b2d763c03cf7d3846b4"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"1a51eae9cbb038f3d5af43a744fd0645ae3b3f4b","unresolved":false,"context_lines":[{"line_number":1045,"context_line":"    return inverse.all()"},{"line_number":1046,"context_line":""},{"line_number":1047,"context_line":""},{"line_number":1048,"context_line":"def get_completed_root_executions(columns):"},{"line_number":1049,"context_line":"    query \u003d b.model_query(models.WorkflowExecution, columns\u003dcolumns)"},{"line_number":1050,"context_line":"    # Only WorkflowExecution that are not a child of other WorkflowExecution."},{"line_number":1051,"context_line":"    query \u003d query.filter(models.WorkflowExecution."}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_a711c7ae","line":1048,"in_reply_to":"1a1ced50_2f5dd7e9","updated":"2017-03-18 15:42:03.000000000","message":"Done","commit_id":"9415b98947ce315928617b2d763c03cf7d3846b4"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"1bcf54c743d91da62816e76b137ba45a809d9df7","unresolved":false,"context_lines":[{"line_number":18,"context_line":"import sys"},{"line_number":19,"context_line":"import threading"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"from mistral.db.v2.sqlalchemy.models import WorkflowExecution"},{"line_number":22,"context_line":"from oslo_config import cfg"},{"line_number":23,"context_line":"from oslo_db import exception as db_exc"},{"line_number":24,"context_line":"from oslo_db import sqlalchemy as oslo_sqlalchemy"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_88a18dac","line":21,"updated":"2017-03-26 21:20:41.000000000","message":"wrong place for this import","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"ccaa4f3ae24d6b1375d9038e864bec75875f688d","unresolved":false,"context_lines":[{"line_number":18,"context_line":"import sys"},{"line_number":19,"context_line":"import threading"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"from mistral.db.v2.sqlalchemy.models import WorkflowExecution"},{"line_number":22,"context_line":"from oslo_config import cfg"},{"line_number":23,"context_line":"from oslo_db import exception as db_exc"},{"line_number":24,"context_line":"from oslo_db import sqlalchemy as oslo_sqlalchemy"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_68f3de0b","line":21,"in_reply_to":"ffe62b97_88a18dac","updated":"2017-03-27 08:08:11.000000000","message":"Yes, I will move it, but how come pep8 failed to detect this?","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"1bcf54c743d91da62816e76b137ba45a809d9df7","unresolved":false,"context_lines":[{"line_number":1024,"context_line":""},{"line_number":1025,"context_line":""},{"line_number":1026,"context_line":"@b.session_aware()"},{"line_number":1027,"context_line":"def get_executions_to_clean(time, limit\u003dNone, max_finished_executions\u003dNone,"},{"line_number":1028,"context_line":"                            columns\u003d(), session\u003dNone):"},{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_48ab8588","line":1027,"range":{"start_line":1027,"start_character":28,"end_line":1027,"end_character":32},"updated":"2017-03-26 21:20:41.000000000","message":"\u0027time\u0027 here is very easy to conflict with python \u0027time\u0027 module, i suggest you choose another name.","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"ccaa4f3ae24d6b1375d9038e864bec75875f688d","unresolved":false,"context_lines":[{"line_number":1024,"context_line":""},{"line_number":1025,"context_line":""},{"line_number":1026,"context_line":"@b.session_aware()"},{"line_number":1027,"context_line":"def get_executions_to_clean(time, limit\u003dNone, max_finished_executions\u003dNone,"},{"line_number":1028,"context_line":"                            columns\u003d(), session\u003dNone):"},{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_85e04bce","line":1027,"range":{"start_line":1027,"start_character":28,"end_line":1027,"end_character":32},"in_reply_to":"ffe62b97_48ab8588","updated":"2017-03-27 08:08:11.000000000","message":"Indeed, I will rename it","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"1bcf54c743d91da62816e76b137ba45a809d9df7","unresolved":false,"context_lines":[{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"},{"line_number":1031,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1032,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"},{"line_number":1033,"context_line":"    query \u003d query.filter(models.WorkflowExecution.updated_at \u003e\u003d time)"},{"line_number":1034,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1035,"context_line":"    if max_finished_executions:"},{"line_number":1036,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    # and take the inverse of that set"},{"line_number":1039,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_a899f179","line":1036,"range":{"start_line":1032,"start_character":0,"end_line":1036,"end_character":52},"updated":"2017-03-26 21:20:41.000000000","message":"I don\u0027t quite understand the logic here, can you put some note comment about why you changed the way to get expired executions?","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"ec0ee0c217ef2b0ab296c820ede8d1e9599e5b70","unresolved":false,"context_lines":[{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"},{"line_number":1031,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1032,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"},{"line_number":1033,"context_line":"    query \u003d query.filter(models.WorkflowExecution.updated_at \u003e\u003d time)"},{"line_number":1034,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1035,"context_line":"    if max_finished_executions:"},{"line_number":1036,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    # and take the inverse of that set"},{"line_number":1039,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_f9d7c24e","line":1036,"range":{"start_line":1032,"start_character":0,"end_line":1036,"end_character":52},"in_reply_to":"ffe62b97_28af16e4","updated":"2017-03-27 09:08:40.000000000","message":"ok, how about following way:\n\n    count \u003d total count of compleated executions\n    if max_finished_executions and max_finished_executions \u003e count:\n        return\n    can_delete_count \u003d count - max_finished_executions\n    can_delete_count \u003d can_delete_count if can_delete_count \u003c limit else limit\n    query \u003d query.filter(models.WorkflowExecution.updated_at \u003c time).order_by(models.WorkflowExecution.updated_at.asc()).limit(can_delete_count).all()","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"ccaa4f3ae24d6b1375d9038e864bec75875f688d","unresolved":false,"context_lines":[{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"},{"line_number":1031,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1032,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"},{"line_number":1033,"context_line":"    query \u003d query.filter(models.WorkflowExecution.updated_at \u003e\u003d time)"},{"line_number":1034,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1035,"context_line":"    if max_finished_executions:"},{"line_number":1036,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    # and take the inverse of that set"},{"line_number":1039,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_28af16e4","line":1036,"range":{"start_line":1032,"start_character":0,"end_line":1036,"end_character":52},"in_reply_to":"ffe62b97_a899f179","updated":"2017-03-27 08:08:11.000000000","message":"The task of the whole function is basically to get all the expired executions, and the remaining portion of the not expired executions (considering max_finished_executions). \n\nTo sum it up, this query gets the ids of the executions that won\u0027t be deleted. So it queries for the not expired (but completed) executions limited by max_finished_executions. All the other completed executions are considered for deletion, that is why the inverse query in the next step. \n\n(I guess it could be done in a single query but I failed to figure it out with sqlalchemy.)","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"5efa5cbf27899c5dc6917c280cfe93edce3f01b7","unresolved":false,"context_lines":[{"line_number":1029,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1030,"context_line":"    # these are the not expired executions,"},{"line_number":1031,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1032,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"},{"line_number":1033,"context_line":"    query \u003d query.filter(models.WorkflowExecution.updated_at \u003e\u003d time)"},{"line_number":1034,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1035,"context_line":"    if max_finished_executions:"},{"line_number":1036,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    # and take the inverse of that set"},{"line_number":1039,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_b34b8b29","line":1036,"range":{"start_line":1032,"start_character":0,"end_line":1036,"end_character":52},"in_reply_to":"ffe62b97_f9d7c24e","updated":"2017-03-27 12:52:10.000000000","message":"This query gets the \u0027count - max_finished_executions\u0027 amount of oldest expired executions. Why is this good for us? What about the not expired executions that this review is about?\n\nCould you explain in an other way, I don\u0027t get it:)","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"fdfa4ab5f8625e360f9b114cfb8107ef4b16734b","unresolved":false,"context_lines":[{"line_number":1041,"context_line":"    # and take the inverse of that set"},{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1045,"context_line":"    if limit:"},{"line_number":1046,"context_line":"        inverse.limit(limit)"},{"line_number":1047,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dfeb2761_c3fab973","line":1044,"range":{"start_line":1044,"start_character":67,"end_line":1044,"end_character":71},"updated":"2017-04-03 23:30:48.000000000","message":"Should we use \u0027asc\u0027 here to get oldest executions first?","commit_id":"c320ee5d354791d7045ff73523c88247ed01c7fe"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"14bb3f46a5c2c24c602637d10aebdb160ac5f797","unresolved":false,"context_lines":[{"line_number":1041,"context_line":"    # and take the inverse of that set"},{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1045,"context_line":"    if limit:"},{"line_number":1046,"context_line":"        inverse.limit(limit)"},{"line_number":1047,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"dfeb2761_b8a8fbda","line":1044,"range":{"start_line":1044,"start_character":67,"end_line":1044,"end_character":71},"in_reply_to":"dfeb2761_c3fab973","updated":"2017-04-04 07:55:14.000000000","message":"Yes, asc is probably better. In the other hand the order does not really matter so I thought about removing this line entirely.","commit_id":"c320ee5d354791d7045ff73523c88247ed01c7fe"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1027,"context_line":"def get_executions_to_clean(expiration_time, limit\u003dNone,"},{"line_number":1028,"context_line":"                            max_finished_executions\u003dNone, columns\u003d(),"},{"line_number":1029,"context_line":"                            session\u003dNone):"},{"line_number":1030,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1031,"context_line":"    # these are the not expired executions,"},{"line_number":1032,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1033,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_0fd31a62","line":1030,"range":{"start_line":1030,"start_character":6,"end_line":1030,"end_character":9},"updated":"2017-04-04 09:17:26.000000000","message":"Please start all comments with a capital and end with a period, and, in general, format them as regular english sentences.","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1027,"context_line":"def get_executions_to_clean(expiration_time, limit\u003dNone,"},{"line_number":1028,"context_line":"                            max_finished_executions\u003dNone, columns\u003d(),"},{"line_number":1029,"context_line":"                            session\u003dNone):"},{"line_number":1030,"context_line":"    # get the ids of the executions that won\u0027t be deleted"},{"line_number":1031,"context_line":"    # these are the not expired executions,"},{"line_number":1032,"context_line":"    # limited by the new max_finished_executions constraint"},{"line_number":1033,"context_line":"    query \u003d _get_completed_root_executions(columns\u003d(WorkflowExecution.id,))"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_b7cd8867","line":1030,"range":{"start_line":1030,"start_character":6,"end_line":1030,"end_character":9},"in_reply_to":"dfeb2761_0fd31a62","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1035,"context_line":"        models.WorkflowExecution.updated_at \u003e\u003d expiration_time"},{"line_number":1036,"context_line":"    )"},{"line_number":1037,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1038,"context_line":"    if max_finished_executions:"},{"line_number":1039,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"    # and take the inverse of that set"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_ef6356b0","line":1038,"updated":"2017-04-04 09:17:26.000000000","message":"Soft: we usually put a blank line before all control structures (if, try, return etc.)","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1035,"context_line":"        models.WorkflowExecution.updated_at \u003e\u003d expiration_time"},{"line_number":1036,"context_line":"    )"},{"line_number":1037,"context_line":"    query \u003d query.order_by(models.WorkflowExecution.updated_at.desc())"},{"line_number":1038,"context_line":"    if max_finished_executions:"},{"line_number":1039,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"    # and take the inverse of that set"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_97cf2455","line":1038,"in_reply_to":"dfeb2761_ef6356b0","updated":"2017-04-10 12:46:05.000000000","message":"Good to know:)","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1038,"context_line":"    if max_finished_executions:"},{"line_number":1039,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"    # and take the inverse of that set"},{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.asc())"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_efd59644","line":1041,"range":{"start_line":1041,"start_character":6,"end_line":1041,"end_character":38},"updated":"2017-04-04 09:17:26.000000000","message":"Same","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1038,"context_line":"    if max_finished_executions:"},{"line_number":1039,"context_line":"        query \u003d query.limit(max_finished_executions)"},{"line_number":1040,"context_line":""},{"line_number":1041,"context_line":"    # and take the inverse of that set"},{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.asc())"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_b7fb4877","line":1041,"range":{"start_line":1041,"start_character":6,"end_line":1041,"end_character":38},"in_reply_to":"dfeb2761_efd59644","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.asc())"},{"line_number":1045,"context_line":"    if limit:"},{"line_number":1046,"context_line":"        inverse.limit(limit)"},{"line_number":1047,"context_line":""},{"line_number":1048,"context_line":"    return inverse.all()"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_8f74ca69","line":1045,"range":{"start_line":1045,"start_character":4,"end_line":1045,"end_character":6},"updated":"2017-04-04 09:17:26.000000000","message":"Soft: Same","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1042,"context_line":"    inverse \u003d _get_completed_root_executions(columns)"},{"line_number":1043,"context_line":"    inverse \u003d inverse.filter(~WorkflowExecution.id.in_(query))"},{"line_number":1044,"context_line":"    inverse \u003d inverse.order_by(models.WorkflowExecution.updated_at.asc())"},{"line_number":1045,"context_line":"    if limit:"},{"line_number":1046,"context_line":"        inverse.limit(limit)"},{"line_number":1047,"context_line":""},{"line_number":1048,"context_line":"    return inverse.all()"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_97f8447b","line":1045,"range":{"start_line":1045,"start_character":4,"end_line":1045,"end_character":6},"in_reply_to":"dfeb2761_8f74ca69","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1048,"context_line":"    return inverse.all()"},{"line_number":1049,"context_line":""},{"line_number":1050,"context_line":""},{"line_number":1051,"context_line":"def _get_completed_root_executions(columns):"},{"line_number":1052,"context_line":"    query \u003d b.model_query(models.WorkflowExecution, columns\u003dcolumns)"},{"line_number":1053,"context_line":"    # Only WorkflowExecution that are not a child of other WorkflowExecution."},{"line_number":1054,"context_line":"    query \u003d query.filter(models.WorkflowExecution."}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_8f95ea42","line":1051,"range":{"start_line":1051,"start_character":4,"end_line":1051,"end_character":34},"updated":"2017-04-04 09:17:26.000000000","message":"I would rather rename it to \"_get_completed_root_executions_query\" to make it clear that it returns a query, not a collection of objects.","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1048,"context_line":"    return inverse.all()"},{"line_number":1049,"context_line":""},{"line_number":1050,"context_line":""},{"line_number":1051,"context_line":"def _get_completed_root_executions(columns):"},{"line_number":1052,"context_line":"    query \u003d b.model_query(models.WorkflowExecution, columns\u003dcolumns)"},{"line_number":1053,"context_line":"    # Only WorkflowExecution that are not a child of other WorkflowExecution."},{"line_number":1054,"context_line":"    query \u003d query.filter(models.WorkflowExecution."}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_77f14095","line":1051,"range":{"start_line":1051,"start_character":4,"end_line":1051,"end_character":34},"in_reply_to":"dfeb2761_8f95ea42","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"}],"mistral/services/expiration_policy.py":[{"author":{"_account_id":21970,"name":"Andras Kovi","email":"akovi@nokia.com","username":"andras.kovi"},"change_message_id":"bb0b954c4ed26f5873c60c04045b05272deb1daa","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"def _delete_expired_executions(batch_size, expired_time,"},{"line_number":61,"context_line":"                               max_finished_executions):"},{"line_number":62,"context_line":"    while True:"},{"line_number":63,"context_line":"        with db_api.transaction():"},{"line_number":64,"context_line":"            # TODO(gpaz): In the future should use generic method with"},{"line_number":65,"context_line":"            # filters params and not specific method that filter by time."}],"source_content_type":"text/x-python","patch_set":2,"id":"1a1ced50_40af1494","line":62,"updated":"2017-03-19 15:12:25.000000000","message":"Infinite loop constructs are quite dangerous and should be avoided. Maybe better this way:\n\ndef delete_executions():\n  \u003ccode\u003e\n  return expired_executions\n\nwhile delete_executions():\n  pass\n\nThanks!","commit_id":"7e82b2aa8d9b3c6de24f9b336f6021de6010c871"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":57,"context_line":"                      \"is not configured or older_than \u003c \u00271\u0027.\")"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"def _delete_expired_executions(batch_size, expiration_time,"},{"line_number":61,"context_line":"                               max_finished_executions):"},{"line_number":62,"context_line":"    def delete_and_return():"},{"line_number":63,"context_line":"        with db_api.transaction():"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_efbb56c1","line":60,"range":{"start_line":60,"start_character":12,"end_line":60,"end_character":19},"updated":"2017-04-04 09:17:26.000000000","message":"Maybe we need to remove \"expired\" from naming?","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":57,"context_line":"                      \"is not configured or older_than \u003c \u00271\u0027.\")"},{"line_number":58,"context_line":""},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"def _delete_expired_executions(batch_size, expiration_time,"},{"line_number":61,"context_line":"                               max_finished_executions):"},{"line_number":62,"context_line":"    def delete_and_return():"},{"line_number":63,"context_line":"        with db_api.transaction():"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_d737ec4c","line":60,"range":{"start_line":60,"start_character":12,"end_line":60,"end_character":19},"in_reply_to":"dfeb2761_efbb56c1","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        with db_api.transaction():"},{"line_number":64,"context_line":"            # TODO(gpaz): In the future should use generic method with"},{"line_number":65,"context_line":"            # filters params and not specific method that filter by time."},{"line_number":66,"context_line":"            expired_executions \u003d db_api.get_executions_to_clean("},{"line_number":67,"context_line":"                expiration_time,"},{"line_number":68,"context_line":"                limit\u003dbatch_size,"},{"line_number":69,"context_line":"                max_finished_executions\u003dmax_finished_executions"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_6fcce660","line":66,"range":{"start_line":66,"start_character":12,"end_line":66,"end_character":19},"updated":"2017-04-04 09:17:26.000000000","message":"Same. I\u0027d even it call it simpler here like \"execs\" or something like that, it\u0027s a local variable with a very narrow scope.","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        with db_api.transaction():"},{"line_number":64,"context_line":"            # TODO(gpaz): In the future should use generic method with"},{"line_number":65,"context_line":"            # filters params and not specific method that filter by time."},{"line_number":66,"context_line":"            expired_executions \u003d db_api.get_executions_to_clean("},{"line_number":67,"context_line":"                expiration_time,"},{"line_number":68,"context_line":"                limit\u003dbatch_size,"},{"line_number":69,"context_line":"                max_finished_executions\u003dmax_finished_executions"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_973de42c","line":66,"range":{"start_line":66,"start_character":12,"end_line":66,"end_character":19},"in_reply_to":"dfeb2761_6fcce660","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":70,"context_line":"            )"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"            _delete(expired_executions)"},{"line_number":73,"context_line":"            return expired_executions"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    while delete_and_return():"},{"line_number":76,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_ef2eb6f8","line":73,"updated":"2017-04-04 09:17:26.000000000","message":"Soft: Please insert a blank line before \u0027return\u0027","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            _delete(expired_executions)"},{"line_number":73,"context_line":"            return expired_executions"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    while delete_and_return():"},{"line_number":76,"context_line":"        pass"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"def _delete(exp_executions):"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_8f6dea33","line":76,"range":{"start_line":75,"start_character":4,"end_line":76,"end_character":12},"updated":"2017-04-04 09:17:26.000000000","message":"This looks a little weird to me :) I\u0027m not strongly against it but I\u0027d probably prefer the previous form with \"while True\".","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            _delete(expired_executions)"},{"line_number":73,"context_line":"            return expired_executions"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    while delete_and_return():"},{"line_number":76,"context_line":"        pass"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"def _delete(exp_executions):"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_b72908e7","line":76,"range":{"start_line":75,"start_character":4,"end_line":76,"end_character":12},"in_reply_to":"dfeb2761_8f6dea33","updated":"2017-04-10 12:46:05.000000000","message":"I reverted this part to the previous solution.","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"}],"mistral/tests/unit/services/test_expired_executions_policy.py":[{"author":{"_account_id":20863,"name":"Sharat Sharma","email":"sharat.sharma@in.ibm.com","username":"sharat.sharma"},"change_message_id":"2a74c705673d94de03af5c2c642705eb22ea3fba","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        # the sub execution (654) and the one allowed finished execution"},{"line_number":278,"context_line":"        # (987) are there."},{"line_number":279,"context_line":"        execs \u003d db_api.get_workflow_executions()"},{"line_number":280,"context_line":"        self.assertEqual(4, len(execs))"},{"line_number":281,"context_line":"        self.assertListEqual("},{"line_number":282,"context_line":"            [\u0027654\u0027, \u0027789\u0027, \u00277899\u0027, \u0027987\u0027],"},{"line_number":283,"context_line":"            sorted([ex.id for ex in execs])"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_52bb9372","line":280,"range":{"start_line":280,"start_character":25,"end_line":280,"end_character":26},"updated":"2017-03-17 09:50:04.000000000","message":"This is causing the failure","commit_id":"9415b98947ce315928617b2d763c03cf7d3846b4"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"8fc2392c4ccf147b09483d51709e5d043738213d","unresolved":false,"context_lines":[{"line_number":277,"context_line":"        # the sub execution (654) and the one allowed finished execution"},{"line_number":278,"context_line":"        # (987) are there."},{"line_number":279,"context_line":"        execs \u003d db_api.get_workflow_executions()"},{"line_number":280,"context_line":"        self.assertEqual(4, len(execs))"},{"line_number":281,"context_line":"        self.assertListEqual("},{"line_number":282,"context_line":"            [\u0027654\u0027, \u0027789\u0027, \u00277899\u0027, \u0027987\u0027],"},{"line_number":283,"context_line":"            sorted([ex.id for ex in execs])"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_ed8e6226","line":280,"range":{"start_line":280,"start_character":25,"end_line":280,"end_character":26},"in_reply_to":"1a1ced50_52bb9372","updated":"2017-03-17 10:06:12.000000000","message":"Yeah I know, but the assert is definitely correct. The mistake must be in the implementation somewhere. It passes in my local environment, and I\u0027m still investigating it.","commit_id":"9415b98947ce315928617b2d763c03cf7d3846b4"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"5efa5cbf27899c5dc6917c280cfe93edce3f01b7","unresolved":false,"context_lines":[{"line_number":112,"context_line":"    )"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"def _switch_context(is_default, is_admin):"},{"line_number":116,"context_line":"    ctx.set_ctx(get_context(is_default, is_admin))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_7364e3e4","line":115,"updated":"2017-03-27 12:52:10.000000000","message":"Also, when I refactored this part I realized later that the _switch_context calls are meaningless. All the tests pass without them... should I just remove them to make the tests more compact? Or leave it in only one test-case?","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"ec0ee0c217ef2b0ab296c820ede8d1e9599e5b70","unresolved":false,"context_lines":[{"line_number":253,"context_line":"        execs \u003d db_api.get_executions_to_clean(now)"},{"line_number":254,"context_line":"        self.assertEqual(0, len(execs))"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def test_expiration_policy_for_executions_with_max_executions(self):"},{"line_number":257,"context_line":"        # Since we are removing other projects execution,"},{"line_number":258,"context_line":"        # we want to load the executions with other project_id."},{"line_number":259,"context_line":"        _switch_context(False, False)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_7992924d","line":256,"range":{"start_line":256,"start_character":8,"end_line":256,"end_character":65},"updated":"2017-03-27 09:08:40.000000000","message":"I think more tests should be added to cover at least the following scenarios:\n\n- max_finished_executions \u003e total completed executions\n- batch_size + max_finished_executions \u003e total completed executions","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"5efa5cbf27899c5dc6917c280cfe93edce3f01b7","unresolved":false,"context_lines":[{"line_number":253,"context_line":"        execs \u003d db_api.get_executions_to_clean(now)"},{"line_number":254,"context_line":"        self.assertEqual(0, len(execs))"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def test_expiration_policy_for_executions_with_max_executions(self):"},{"line_number":257,"context_line":"        # Since we are removing other projects execution,"},{"line_number":258,"context_line":"        # we want to load the executions with other project_id."},{"line_number":259,"context_line":"        _switch_context(False, False)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ffe62b97_6003e710","line":256,"range":{"start_line":256,"start_character":8,"end_line":256,"end_character":65},"in_reply_to":"ffe62b97_7992924d","updated":"2017-03-27 12:52:10.000000000","message":"I added a new test to cover these cases.","commit_id":"dacae57da386883ce92d226543b47b4a4617276a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"9e9e399a5bb624c3133ae7822739e2a839c3bb8f","unresolved":false,"context_lines":[{"line_number":53,"context_line":"            \u0027state\u0027: \"RUNNING\","},{"line_number":54,"context_line":"        },"},{"line_number":55,"context_line":"        {"},{"line_number":56,"context_line":"            \u0027id\u0027: \u00277899\u0027,"},{"line_number":57,"context_line":"            \u0027name\u0027: \u0027running_not_expired2\u0027,"},{"line_number":58,"context_line":"            \u0027created_at\u0027: time_now - datetime.timedelta(days\u003d3, minutes\u003d10),"},{"line_number":59,"context_line":"            \u0027updated_at\u0027: time_now - datetime.timedelta(days\u003d4),"}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_01640449","line":56,"range":{"start_line":56,"start_character":19,"end_line":56,"end_character":23},"updated":"2017-03-27 22:08:30.000000000","message":"Please give these executions meaningful names so it would be easy to read the tests.","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c3868d450ade9719cdd4ad9fff01b22655b83651","unresolved":false,"context_lines":[{"line_number":53,"context_line":"            \u0027state\u0027: \"RUNNING\","},{"line_number":54,"context_line":"        },"},{"line_number":55,"context_line":"        {"},{"line_number":56,"context_line":"            \u0027id\u0027: \u00277899\u0027,"},{"line_number":57,"context_line":"            \u0027name\u0027: \u0027running_not_expired2\u0027,"},{"line_number":58,"context_line":"            \u0027created_at\u0027: time_now - datetime.timedelta(days\u003d3, minutes\u003d10),"},{"line_number":59,"context_line":"            \u0027updated_at\u0027: time_now - datetime.timedelta(days\u003d4),"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_9069d9bf","line":56,"range":{"start_line":56,"start_character":19,"end_line":56,"end_character":23},"in_reply_to":"ffe62b97_01640449","updated":"2017-03-31 19:19:47.000000000","message":"Done","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"9e9e399a5bb624c3133ae7822739e2a839c3bb8f","unresolved":false,"context_lines":[{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        # Since we are removing other projects execution,"},{"line_number":225,"context_line":"        # we want to load the executions with other project_id."},{"line_number":226,"context_line":"        _switch_context(False, False)"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"        _create_workflow_executions()"},{"line_number":229,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_41fb2c46","line":226,"range":{"start_line":226,"start_character":8,"end_line":226,"end_character":23},"updated":"2017-03-27 22:08:30.000000000","message":"you need to override \u0027auth_enable\u0027 option","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c3868d450ade9719cdd4ad9fff01b22655b83651","unresolved":false,"context_lines":[{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        # Since we are removing other projects execution,"},{"line_number":225,"context_line":"        # we want to load the executions with other project_id."},{"line_number":226,"context_line":"        _switch_context(False, False)"},{"line_number":227,"context_line":""},{"line_number":228,"context_line":"        _create_workflow_executions()"},{"line_number":229,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_30b56d32","line":226,"range":{"start_line":226,"start_character":8,"end_line":226,"end_character":23},"in_reply_to":"ffe62b97_41fb2c46","updated":"2017-03-31 19:19:47.000000000","message":"I kept the context switching in only one of the tests, this way the remaining tests are cleaner.\n\nIt is unnecessary to retest it in every case.","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"9e9e399a5bb624c3133ae7822739e2a839c3bb8f","unresolved":false,"context_lines":[{"line_number":254,"context_line":"        self.assertEqual(0, len(execs))"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def test_expiration_policy_for_executions_with_max_executions_scen1(self):"},{"line_number":257,"context_line":"        # tests the max_executions logic with"},{"line_number":258,"context_line":"        # max_finished_executions \u003d"},{"line_number":259,"context_line":"        # \u0027total not expired and completed executions\u0027 - 1"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"        # Since we are removing other projects execution,"},{"line_number":262,"context_line":"        # we want to load the executions with other project_id."}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_41756c31","line":259,"range":{"start_line":257,"start_character":0,"end_line":259,"end_character":58},"updated":"2017-03-27 22:08:30.000000000","message":"Please move this to function docstring.","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c3868d450ade9719cdd4ad9fff01b22655b83651","unresolved":false,"context_lines":[{"line_number":254,"context_line":"        self.assertEqual(0, len(execs))"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def test_expiration_policy_for_executions_with_max_executions_scen1(self):"},{"line_number":257,"context_line":"        # tests the max_executions logic with"},{"line_number":258,"context_line":"        # max_finished_executions \u003d"},{"line_number":259,"context_line":"        # \u0027total not expired and completed executions\u0027 - 1"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"        # Since we are removing other projects execution,"},{"line_number":262,"context_line":"        # we want to load the executions with other project_id."}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_b0829d4e","line":259,"range":{"start_line":257,"start_character":0,"end_line":259,"end_character":58},"in_reply_to":"ffe62b97_41756c31","updated":"2017-03-31 19:19:47.000000000","message":"Done it with all the test cases.","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"9e9e399a5bb624c3133ae7822739e2a839c3bb8f","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        )"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    def test_expiration_policy_for_executions_with_max_executions_scen2(self):"},{"line_number":291,"context_line":"        # tests the max_executions logic with:"},{"line_number":292,"context_line":"        # max_finished_executions \u003e total completed executions"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"        # Since we are removing other projects execution,"},{"line_number":295,"context_line":"        # we want to load the executions with other project_id."}],"source_content_type":"text/x-python","patch_set":5,"id":"ffe62b97_e1cda031","line":292,"range":{"start_line":291,"start_character":0,"end_line":292,"end_character":62},"updated":"2017-03-27 22:08:30.000000000","message":"ditto","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c3868d450ade9719cdd4ad9fff01b22655b83651","unresolved":false,"context_lines":[{"line_number":288,"context_line":"        )"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    def test_expiration_policy_for_executions_with_max_executions_scen2(self):"},{"line_number":291,"context_line":"        # tests the max_executions logic with:"},{"line_number":292,"context_line":"        # max_finished_executions \u003e total completed executions"},{"line_number":293,"context_line":""},{"line_number":294,"context_line":"        # Since we are removing other projects execution,"},{"line_number":295,"context_line":"        # we want to load the executions with other project_id."}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_90979991","line":292,"range":{"start_line":291,"start_character":0,"end_line":292,"end_character":62},"in_reply_to":"ffe62b97_e1cda031","updated":"2017-03-31 19:19:47.000000000","message":"Done","commit_id":"eb140bb9cd218ea11e764a3c5c842afa1e9eb5d7"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"65536f1d3a4a8edc032229baf39315a599c692cf","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2015 - Alcatel-lucent, Inc."},{"line_number":2,"context_line":"# Copyright 2015 - StackStorm, Inc."},{"line_number":3,"context_line":"# Copyright 2016 - Brocade Communications Systems, Inc."},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":9,"id":"dfeb2761_afa2ee49","line":1,"range":{"start_line":1,"start_character":0,"end_line":1,"end_character":1},"updated":"2017-04-04 09:17:26.000000000","message":"Soft: I think we should rename this file to \"test_execution_expiration_policy\" or just \"test_expiration_policy\".","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"},{"author":{"_account_id":23211,"name":"Kupai József","email":"jozsef.kupai@nokia.com","username":"kupsef"},"change_message_id":"c7bdbfadf6d580244247645a32e64ea47a4b8f9c","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2015 - Alcatel-lucent, Inc."},{"line_number":2,"context_line":"# Copyright 2015 - StackStorm, Inc."},{"line_number":3,"context_line":"# Copyright 2016 - Brocade Communications Systems, Inc."},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":9,"id":"bff0334d_377bb8f5","line":1,"range":{"start_line":1,"start_character":0,"end_line":1,"end_character":1},"in_reply_to":"dfeb2761_afa2ee49","updated":"2017-04-10 12:46:05.000000000","message":"Done","commit_id":"c820ac34613200528e6da3f967aae50a5ec594d6"}]}
