)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"17ce50268a2e49c44bfdbeb404a179de833ea012","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Implementing with-items concurrency"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Implements blueprint: with-items-concurrency"},{"line_number":10,"context_line":"Related-Bug: #1476871"},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Ifb193f06ae8e9becb6c43f36c07f5ffddb04c71c"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3a50d1a3_5781568e","line":9,"updated":"2015-07-25 01:46:34.000000000","message":"Hi, I can\u0027t find the blueprint via the link, can you? Just want to know wholely about what this patch wanna do.","commit_id":"7047c9f7d8cc53f00a4940d31b26019be6d771d2"}],"mistral/engine/task_handler.py":[{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"a2564e05316912fb835f959684a934907afc8736","unresolved":false,"context_lines":[{"line_number":233,"context_line":""},{"line_number":234,"context_line":""},{"line_number":235,"context_line":"def _get_with_items_input(wf_spec, task_ex, task_spec, ctx):"},{"line_number":236,"context_line":"    \"\"\"Calculate input array for separating each action input."},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    Example:"},{"line_number":239,"context_line":"      DSL:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_b9be5dfd","line":236,"updated":"2015-07-27 15:39:49.000000000","message":"docstring of this function should be changed according to the change.","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"a2564e05316912fb835f959684a934907afc8736","unresolved":false,"context_lines":[{"line_number":286,"context_line":"    begin, end \u003d with_items.get_indexes_for_loop(task_ex)"},{"line_number":287,"context_line":"    with_items.do_steps(task_ex, end - begin)"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    return zip(six.moves.xrange(begin, end), action_inputs[begin:end])"},{"line_number":290,"context_line":""},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"def _get_action_input(wf_spec, task_ex, task_spec, ctx):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_1950b15d","line":289,"updated":"2015-07-27 15:39:49.000000000","message":"According to the logic here, for a new task(no actions were ever executed) if concurrency\u003d3, len(action_inputs)\u003d2, then (begin, end) will be (0, 3), right? Is that problematic?","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"332af855c55b3ebe1b30083913c49a13891e6212","unresolved":false,"context_lines":[{"line_number":286,"context_line":"    begin, end \u003d with_items.get_indexes_for_loop(task_ex)"},{"line_number":287,"context_line":"    with_items.do_steps(task_ex, end - begin)"},{"line_number":288,"context_line":""},{"line_number":289,"context_line":"    return zip(six.moves.xrange(begin, end), action_inputs[begin:end])"},{"line_number":290,"context_line":""},{"line_number":291,"context_line":""},{"line_number":292,"context_line":"def _get_action_input(wf_spec, task_ex, task_spec, ctx):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_148b6f69","line":289,"in_reply_to":"3a50d1a3_1950b15d","updated":"2015-07-28 10:16:36.000000000","message":"No, it just returns 2 elements in this case.","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"af16ab18c9ea53ad0cda9fb856b716f387e852e5","unresolved":false,"context_lines":[{"line_number":474,"context_line":"    task_ex.state \u003d state"},{"line_number":475,"context_line":""},{"line_number":476,"context_line":""},{"line_number":477,"context_line":"def is_task_incomplete(task_ex, task_spec):"},{"line_number":478,"context_line":"    if task_spec.get_with_items():"},{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_f8427faa","line":477,"updated":"2015-08-03 15:20:23.000000000","message":"I somewhat don\u0027t like the name of this method even though I understand why you don\u0027t mention \"with_items\" in its name (to hide low level details of how task is implemented). What bothers me is the logic in default_engine where you call this method because it first checks the state of the task for completeness and then if it\u0027s not completed from that standpoint you check it for completeness again but in a different way, using this method.","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"0175267eecfabd6f88e9a9d1883ff53b8bceb72d","unresolved":false,"context_lines":[{"line_number":474,"context_line":"    task_ex.state \u003d state"},{"line_number":475,"context_line":""},{"line_number":476,"context_line":""},{"line_number":477,"context_line":"def is_task_incomplete(task_ex, task_spec):"},{"line_number":478,"context_line":"    if task_spec.get_with_items():"},{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"1a4dcd0f_14ae7c85","line":477,"in_reply_to":"3a50d1a3_f8427faa","updated":"2015-08-04 10:22:10.000000000","message":"Done","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"af16ab18c9ea53ad0cda9fb856b716f387e852e5","unresolved":false,"context_lines":[{"line_number":478,"context_line":"    if task_spec.get_with_items():"},{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    completed \u003d all([states.is_completed(ex.state)"},{"line_number":482,"context_line":"                    for ex in task_ex.executions])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    return not completed"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_d872234a","line":481,"updated":"2015-08-03 15:20:23.000000000","message":"Soft: this var could be inlined.","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"0175267eecfabd6f88e9a9d1883ff53b8bceb72d","unresolved":false,"context_lines":[{"line_number":478,"context_line":"    if task_spec.get_with_items():"},{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    completed \u003d all([states.is_completed(ex.state)"},{"line_number":482,"context_line":"                    for ex in task_ex.executions])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    return not completed"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a4dcd0f_34ab7876","line":481,"in_reply_to":"3a50d1a3_d872234a","updated":"2015-08-04 10:22:10.000000000","message":"Done","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":8731,"name":"Renat Akhmerov","email":"renat.akhmerov@gmail.com","username":"rakhmerov"},"change_message_id":"af16ab18c9ea53ad0cda9fb856b716f387e852e5","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    completed \u003d all([states.is_completed(ex.state)"},{"line_number":482,"context_line":"                    for ex in task_ex.executions])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    return not completed"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a50d1a3_78b18fdf","line":482,"updated":"2015-08-03 15:20:23.000000000","message":"It seems like we shouldn\u0027t be iterating over all action executions. For example, if we have a retry policy then some of the action executions may have been invalid (accepted\u003dfalse) and we shouldn\u0027t take them into account.\n\nNikolay, what do you think?","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"0175267eecfabd6f88e9a9d1883ff53b8bceb72d","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        return with_items.has_more_iterations(task_ex)"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    completed \u003d all([states.is_completed(ex.state)"},{"line_number":482,"context_line":"                    for ex in task_ex.executions])"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    return not completed"}],"source_content_type":"text/x-python","patch_set":9,"id":"1a4dcd0f_f4bbd0c2","line":482,"in_reply_to":"3a50d1a3_78b18fdf","updated":"2015-08-04 10:22:10.000000000","message":"Done","commit_id":"92b14e732dca58e5ff0b79e477aa882f1a4f5260"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"7b3febc71991ad41f8181e1b693019b717482029","unresolved":false,"context_lines":[{"line_number":41,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":42,"context_line":""},{"line_number":43,"context_line":""},{"line_number":44,"context_line":"def run_existing_task(task_ex_id, reset\u003dFalse):"},{"line_number":45,"context_line":"    \"\"\"This function runs existing task execution."},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"    It is needed mostly by scheduler."}],"source_content_type":"text/x-python","patch_set":12,"id":"1a4dcd0f_ca92ff56","line":44,"updated":"2015-08-13 05:23:02.000000000","message":"How come this is changed to False by default?","commit_id":"aeecca55dfdaf491d7a860bd297e45a70c51b195"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":318,"context_line":"    with_items.prepare_runtime_context(task_ex, task_spec, action_inputs)"},{"line_number":319,"context_line":""},{"line_number":320,"context_line":"    indices \u003d with_items.get_indices_for_loop(task_ex)"},{"line_number":321,"context_line":"    with_items.do_steps(task_ex, len(indices))"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"    if indices:"},{"line_number":324,"context_line":"        current_inputs \u003d operator.itemgetter(*indices)(action_inputs)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_10d468bb","line":321,"updated":"2015-08-13 22:38:02.000000000","message":"Can we merge with_items.get_indices_for_loop and with_items.do_steps so that when a list of indices is returned for execution, the step is already done?","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":318,"context_line":"    with_items.prepare_runtime_context(task_ex, task_spec, action_inputs)"},{"line_number":319,"context_line":""},{"line_number":320,"context_line":"    indices \u003d with_items.get_indices_for_loop(task_ex)"},{"line_number":321,"context_line":"    with_items.do_steps(task_ex, len(indices))"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"    if indices:"},{"line_number":324,"context_line":"        current_inputs \u003d operator.itemgetter(*indices)(action_inputs)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_e86783b5","line":321,"in_reply_to":"1a4dcd0f_10d468bb","updated":"2015-08-14 09:29:10.000000000","message":"The problem is name of that \u0027magic\u0027 method. The original method \u0027get_indices_for_loop\u0027 just returns indices but in this case it should also do some other work (do_steps). The logic here won\u0027t be so transparent, IMO.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":329,"context_line":"            else [current_inputs]"},{"line_number":330,"context_line":"        )"},{"line_number":331,"context_line":"    else:"},{"line_number":332,"context_line":"        return []"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":""},{"line_number":335,"context_line":"def _get_action_input(wf_spec, task_ex, task_spec, ctx):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_33e72e48","line":332,"updated":"2015-08-13 22:38:02.000000000","message":"Wouldn\u0027t it be simpler to just replace the entire \"if indices: ... else: ...\" with the following?\n\nreturn [(x, action_input) for x, action_input in enumerate(action_inputs) if x in indices]","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":329,"context_line":"            else [current_inputs]"},{"line_number":330,"context_line":"        )"},{"line_number":331,"context_line":"    else:"},{"line_number":332,"context_line":"        return []"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":""},{"line_number":335,"context_line":"def _get_action_input(wf_spec, task_ex, task_spec, ctx):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_e849c3b8","line":332,"in_reply_to":"1a4dcd0f_33e72e48","updated":"2015-08-14 09:29:10.000000000","message":"Yes, it is simplier from developer point but don\u0027t we lost performance here? That statement should iterate over the whole list of input while itemgetter just gets items by their indices.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":521,"context_line":"        return True"},{"line_number":522,"context_line":""},{"line_number":523,"context_line":"    return all([states.is_completed(ex.state)"},{"line_number":524,"context_line":"               for ex in task_ex.executions if not ex.accepted])"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"def need_to_continue(task_ex, task_spec):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_8d46234e","line":524,"updated":"2015-08-13 22:38:02.000000000","message":"I think the above two if statements already handle all the different types of task (either with_items or not). What\u0027s the last return here suppose to catch? I\u0027m asking because why we are checking states of those action executions that not accepted.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":521,"context_line":"        return True"},{"line_number":522,"context_line":""},{"line_number":523,"context_line":"    return all([states.is_completed(ex.state)"},{"line_number":524,"context_line":"               for ex in task_ex.executions if not ex.accepted])"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"def need_to_continue(task_ex, task_spec):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_88935f00","line":524,"in_reply_to":"1a4dcd0f_8d46234e","updated":"2015-08-14 09:29:10.000000000","message":"hmm, maybe you are right. I\u0027ll remove the last check.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":524,"context_line":"               for ex in task_ex.executions if not ex.accepted])"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"def need_to_continue(task_ex, task_spec):"},{"line_number":528,"context_line":"    # For now continue is available only for with-items."},{"line_number":529,"context_line":"    if task_spec.get_with_items():"},{"line_number":530,"context_line":"        return (with_items.has_more_iterations(task_ex)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_4dd6db28","line":527,"updated":"2015-08-13 22:38:02.000000000","message":"How about renaming this method to has_unstarted_items?","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"c77e6a64ff971b40296acebf5fc9a70ed6243a2c","unresolved":false,"context_lines":[{"line_number":328,"context_line":"            current_inputs if isinstance(current_inputs, tuple)"},{"line_number":329,"context_line":"            else [current_inputs]"},{"line_number":330,"context_line":"        )"},{"line_number":331,"context_line":"    else:"},{"line_number":332,"context_line":"        return []"},{"line_number":333,"context_line":""},{"line_number":334,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_04e86515","line":331,"updated":"2015-08-16 07:09:03.000000000","message":"soft: you can remove \u0027else\u0027 here","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"373b45f0c906dccca07c666be8eed8442e9d6d28","unresolved":false,"context_lines":[{"line_number":520,"context_line":"    if states.is_completed(task_ex.state):"},{"line_number":521,"context_line":"        return True"},{"line_number":522,"context_line":""},{"line_number":523,"context_line":"    return all([states.is_completed(ex.state)"},{"line_number":524,"context_line":"               for ex in task_ex.executions if not ex.accepted])"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_02b5b5ce","line":523,"updated":"2015-08-16 08:50:32.000000000","message":"Hi, Nikolay, you didn\u0027t remove this logic according to what Winson asked.","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"cc883c139783eca9ad4d286db119b1f5fc753919","unresolved":false,"context_lines":[{"line_number":520,"context_line":"    if states.is_completed(task_ex.state):"},{"line_number":521,"context_line":"        return True"},{"line_number":522,"context_line":""},{"line_number":523,"context_line":"    return all([states.is_completed(ex.state)"},{"line_number":524,"context_line":"               for ex in task_ex.executions if not ex.accepted])"},{"line_number":525,"context_line":""},{"line_number":526,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_ee17a752","line":523,"in_reply_to":"1a4dcd0f_02b5b5ce","updated":"2015-08-17 12:04:30.000000000","message":"ok, thanks, I just forgot.","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"}],"mistral/tests/unit/engine/test_direct_workflow_rerun.py":[{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"ce840f95a019043f9fab1475ad203eb7c7763e1f","unresolved":false,"context_lines":[{"line_number":351,"context_line":"        task_1_action_exs \u003d db_api.get_action_executions("},{"line_number":352,"context_line":"            task_execution_id\u003dtask_1_ex.id)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        # The single action execution that succeeded should not re-run."},{"line_number":355,"context_line":"        self.assertEqual(6, len(task_1_action_exs))"},{"line_number":356,"context_line":"        self.assertListEqual([\u0027Task 1.0\u0027, \u0027Task 1.1\u0027, \u0027Task 1.2\u0027, \u0027Task 1.3\u0027],"},{"line_number":357,"context_line":"                             task_1_ex.published.get(\u0027v1\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_96f38873","line":354,"updated":"2015-08-17 22:51:28.000000000","message":"Soft: There are two succeeded here.  So should be \"The action executions that succeeded should not re-run.\"","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"6c6f7b6db4abf6cdea48b80a1245ac62813fe678","unresolved":false,"context_lines":[{"line_number":351,"context_line":"        task_1_action_exs \u003d db_api.get_action_executions("},{"line_number":352,"context_line":"            task_execution_id\u003dtask_1_ex.id)"},{"line_number":353,"context_line":""},{"line_number":354,"context_line":"        # The single action execution that succeeded should not re-run."},{"line_number":355,"context_line":"        self.assertEqual(6, len(task_1_action_exs))"},{"line_number":356,"context_line":"        self.assertListEqual([\u0027Task 1.0\u0027, \u0027Task 1.1\u0027, \u0027Task 1.2\u0027, \u0027Task 1.3\u0027],"},{"line_number":357,"context_line":"                             task_1_ex.published.get(\u0027v1\u0027))"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_cdee3b8b","line":354,"in_reply_to":"fa1b9901_96f38873","updated":"2015-08-19 09:47:10.000000000","message":"Oh, yes. I\u0027ve just copied that from your test as well :)","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"}],"mistral/tests/unit/engine/test_with_items.py":[{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"a2564e05316912fb835f959684a934907afc8736","unresolved":false,"context_lines":[{"line_number":506,"context_line":""},{"line_number":507,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":508,"context_line":"        self.assert_capacity(0, task_ex)"},{"line_number":509,"context_line":"        # 1st iteration complete."},{"line_number":510,"context_line":""},{"line_number":511,"context_line":"        self.engine.on_action_complete("},{"line_number":512,"context_line":"            self.get_incomplete_action_ex(task_ex).id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_04fa88bd","line":509,"updated":"2015-07-27 15:39:49.000000000","message":"this comment shoud be removed below","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"332af855c55b3ebe1b30083913c49a13891e6212","unresolved":false,"context_lines":[{"line_number":506,"context_line":""},{"line_number":507,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":508,"context_line":"        self.assert_capacity(0, task_ex)"},{"line_number":509,"context_line":"        # 1st iteration complete."},{"line_number":510,"context_line":""},{"line_number":511,"context_line":"        self.engine.on_action_complete("},{"line_number":512,"context_line":"            self.get_incomplete_action_ex(task_ex).id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_af27c8b4","line":509,"in_reply_to":"3a50d1a3_04fa88bd","updated":"2015-07-28 10:16:36.000000000","message":"ok","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"a2564e05316912fb835f959684a934907afc8736","unresolved":false,"context_lines":[{"line_number":532,"context_line":"        )"},{"line_number":533,"context_line":""},{"line_number":534,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":535,"context_line":"        self.assert_capacity(1, task_ex)"},{"line_number":536,"context_line":""},{"line_number":537,"context_line":"        self._await("},{"line_number":538,"context_line":"            lambda: self.is_execution_success(wf_ex.id),"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_64aeec99","line":535,"updated":"2015-07-27 15:39:49.000000000","message":"sorry, still don\u0027t understand the meaning of \u0027capacity\u0027 property of run_time_context, could you explain in more detail? thanks!","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"332af855c55b3ebe1b30083913c49a13891e6212","unresolved":false,"context_lines":[{"line_number":532,"context_line":"        )"},{"line_number":533,"context_line":""},{"line_number":534,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":535,"context_line":"        self.assert_capacity(1, task_ex)"},{"line_number":536,"context_line":""},{"line_number":537,"context_line":"        self._await("},{"line_number":538,"context_line":"            lambda: self.is_execution_success(wf_ex.id),"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a50d1a3_0f183c74","line":535,"in_reply_to":"3a50d1a3_64aeec99","updated":"2015-07-28 10:16:36.000000000","message":"ok. Capacity is a number means how many actions we can start in context of this task and this with-items. Capacity default value is the value of concurrency property of task (or -1 if we don\u0027t specify concurrency). So, first step - starting as many actions as we can according our concurrency. For example, we have concurrency 3 and 7 items in with-items input, so we start first 3 actions and 4 remain (capacity now is 0), wait till one of them completes, then capacity increases to 1, we start next action and so on until we complete all actions.\n\nTry to imagine if you have set of tasks and multicore CPU. And need to run and dispatch all these tasks on each CPU core :)","commit_id":"25cf1f6f270cd1a0f04116cfa02c4c25fbfbccef"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"f6f726b0b4215dbdb4095be1d4dec88597c414e9","unresolved":false,"context_lines":[{"line_number":515,"context_line":""},{"line_number":516,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":517,"context_line":"        self.assert_capacity(0, task_ex)"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"        # 2nd iteration complete."},{"line_number":520,"context_line":"        self.engine.on_action_complete("},{"line_number":521,"context_line":"            self.get_incomplete_action_ex(task_ex).id,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_eb479d78","line":518,"updated":"2015-07-30 01:24:36.000000000","message":"maybe we could also verify that there are 1(the concurrency value) actions running in the system, do the same in subsequent assertions and other tests.","commit_id":"c319edf1242512ebf24af94f14a631bc234276df"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"a43a5af0ae71c1f25377e580e4cc992ebdbb2986","unresolved":false,"context_lines":[{"line_number":515,"context_line":""},{"line_number":516,"context_line":"        task_ex \u003d db_api.get_task_execution(task_ex.id)"},{"line_number":517,"context_line":"        self.assert_capacity(0, task_ex)"},{"line_number":518,"context_line":""},{"line_number":519,"context_line":"        # 2nd iteration complete."},{"line_number":520,"context_line":"        self.engine.on_action_complete("},{"line_number":521,"context_line":"            self.get_incomplete_action_ex(task_ex).id,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_282fc03f","line":518,"in_reply_to":"3a50d1a3_eb479d78","updated":"2015-07-30 08:11:56.000000000","message":"Done","commit_id":"c319edf1242512ebf24af94f14a631bc234276df"}],"mistral/workflow/with_items.py":[{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"f6f726b0b4215dbdb4095be1d4dec88597c414e9","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    if max_concurrency and with_items_context[_CAPACITY] \u003c max_concurrency:"},{"line_number":74,"context_line":"        with_items_context[_CAPACITY] +\u003d 1"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"def prepare_runtime_context(task_ex, task_spec, input_dicts):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_0b668929","line":76,"updated":"2015-07-30 01:24:36.000000000","message":"please move this line and the first 2 lines under \u0027if\u0027 code block, which may be good for performance.","commit_id":"c319edf1242512ebf24af94f14a631bc234276df"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"a43a5af0ae71c1f25377e580e4cc992ebdbb2986","unresolved":false,"context_lines":[{"line_number":73,"context_line":"    if max_concurrency and with_items_context[_CAPACITY] \u003c max_concurrency:"},{"line_number":74,"context_line":"        with_items_context[_CAPACITY] +\u003d 1"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"def prepare_runtime_context(task_ex, task_spec, input_dicts):"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_88113456","line":76,"in_reply_to":"3a50d1a3_0b668929","updated":"2015-07-30 08:11:56.000000000","message":"Done","commit_id":"c319edf1242512ebf24af94f14a631bc234276df"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    )"},{"line_number":40,"context_line":"    count \u003d get_count(task_ex)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    return len(action_exs) \u003d\u003d 1 if not count else count \u003d\u003d len(action_exs)"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"def get_index(task_ex):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_294d8499","line":42,"updated":"2015-08-13 22:38:02.000000000","message":"This is a bit messy.  How about the following?\n\ncount \u003d get_count(task_ex) or 1\n\nreturn count \u003d\u003d len(action_exs)","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":39,"context_line":"    )"},{"line_number":40,"context_line":"    count \u003d get_count(task_ex)"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    return len(action_exs) \u003d\u003d 1 if not count else count \u003d\u003d len(action_exs)"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"def get_index(task_ex):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_c87f27aa","line":42,"in_reply_to":"1a4dcd0f_294d8499","updated":"2015-08-14 09:29:10.000000000","message":"ok, thanks!","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":73,"context_line":"        state\u003dstates.ERROR,"},{"line_number":74,"context_line":"        accepted\u003dFalse"},{"line_number":75,"context_line":"    )"},{"line_number":76,"context_line":"    action_exs +\u003d db_api.get_action_executions("},{"line_number":77,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":78,"context_line":"        state\u003dstates.SUCCESS,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_8da5c348","line":75,"updated":"2015-08-13 22:38:02.000000000","message":"Please separate with empty line here.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":72,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":73,"context_line":"        state\u003dstates.ERROR,"},{"line_number":74,"context_line":"        accepted\u003dFalse"},{"line_number":75,"context_line":"    )"},{"line_number":76,"context_line":"    action_exs +\u003d db_api.get_action_executions("},{"line_number":77,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":78,"context_line":"        state\u003dstates.SUCCESS,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_b3924c4a","line":75,"in_reply_to":"1a4dcd0f_8da5c348","updated":"2015-08-14 09:29:10.000000000","message":"Done","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":78,"context_line":"        state\u003dstates.SUCCESS,"},{"line_number":79,"context_line":"        accepted\u003dFalse"},{"line_number":80,"context_line":"    )"},{"line_number":81,"context_line":"    return action_exs"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_4d66db2a","line":80,"updated":"2015-08-13 22:38:02.000000000","message":"Please separate with empty line here.  Also, we need a function that allows us to query for multiple values. This basically equates to 2 DB calls. Can you do 1 SELECT to get action executions that succeeded and accepted?  And then use set operation on the list of with_items_indexes from the returned action executions against range(0, count) to return the list of missing indexes. These are the ones that need to run. It\u0027ll reduce the amount of DB calls and the function calls you have below.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":78,"context_line":"        state\u003dstates.SUCCESS,"},{"line_number":79,"context_line":"        accepted\u003dFalse"},{"line_number":80,"context_line":"    )"},{"line_number":81,"context_line":"    return action_exs"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_d30118b1","line":80,"in_reply_to":"1a4dcd0f_4d66db2a","updated":"2015-08-14 09:29:10.000000000","message":"The logic is right, but there are some mistakes: \nAll accepted executions won\u0027t contain those ones that are still running and unaccepted. But since theorethically we can have more than one intermediate states, I prefer to determine this using our terminal states - ERROR and SUCCESS. That way I determine what engine should execute in direct way.\n\nBtw, I have an idea to call filter() here on task_ex.executions.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":85,"context_line":"    capacity \u003d _get_context(task_ex)[_CAPACITY]"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    if _get_unaccepted_act_exs(task_ex):"},{"line_number":88,"context_line":"        indices \u003d _get_indices_if_rerun(task_ex)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":91,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_3072c4b1","line":88,"updated":"2015-08-13 22:38:02.000000000","message":"There are two calls to _get_unaccepted_act_exs when the code reaches here. This equates to 4 DB queries.  Can we minimize the DB calls here?","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":85,"context_line":"    capacity \u003d _get_context(task_ex)[_CAPACITY]"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    if _get_unaccepted_act_exs(task_ex):"},{"line_number":88,"context_line":"        indices \u003d _get_indices_if_rerun(task_ex)"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":91,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_6e5a9b2c","line":88,"in_reply_to":"1a4dcd0f_3072c4b1","updated":"2015-08-14 09:29:10.000000000","message":"Done","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":97,"context_line":"    return list(six.moves.range(index, index + number_to_execute))"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def do_steps(task_ex, count):"},{"line_number":101,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    if with_items_context[_CAPACITY] \u003e\u003d count:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_9315e2e6","line":100,"updated":"2015-08-13 22:38:02.000000000","message":"Can we rename this to decrement_concurrency_capacity?  I have a hard time seeing what do_steps actually at first.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":97,"context_line":"    return list(six.moves.range(index, index + number_to_execute))"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def do_steps(task_ex, count):"},{"line_number":101,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    if with_items_context[_CAPACITY] \u003e\u003d count:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_2e8573ac","line":100,"in_reply_to":"1a4dcd0f_9315e2e6","updated":"2015-08-14 09:29:10.000000000","message":"ok","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"12a176929c10185312a24565a3788e90f25ff59b","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"def finish_iteration(task_ex):"},{"line_number":114,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":115,"context_line":"    max_concurrency \u003d task_ex.runtime_context.get(\u0027concurrency\u0027)"},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_7318561f","line":113,"updated":"2015-08-13 22:38:02.000000000","message":"Can we rename this to increment_concurrency_capacity?  I have a hard time seeing what finish_iteration actually do at first. It\u0027s not really finishing iteration here. It\u0027s increasing the available capacity for concurrency.","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"afd677ae697efda21bebc43941ea18eed6cad4d0","unresolved":false,"context_lines":[{"line_number":110,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"def finish_iteration(task_ex):"},{"line_number":114,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":115,"context_line":"    max_concurrency \u003d task_ex.runtime_context.get(\u0027concurrency\u0027)"},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a4dcd0f_ee7c6bb7","line":113,"in_reply_to":"1a4dcd0f_7318561f","updated":"2015-08-14 09:29:10.000000000","message":"ok","commit_id":"654644e25083e1a3d7070e5ddbbf6b15c811b79e"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"c80916b39b6db72889c23334a152646feeff4d43","unresolved":false,"context_lines":[{"line_number":75,"context_line":"def get_indices_for_loop(task_ex):"},{"line_number":76,"context_line":"    capacity \u003d _get_context(task_ex)[_CAPACITY]"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    unaccepted \u003d _get_unaccepted_act_exs(task_ex)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if unaccepted:"},{"line_number":81,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_42e41dab","line":78,"updated":"2015-08-16 09:19:40.000000000","message":"Since you added the logic here, is it possible to add some tests for rerun task which has concurrency property?","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"2ee90f6834f2c3a7d4746591c596c5cdba64828b","unresolved":false,"context_lines":[{"line_number":75,"context_line":"def get_indices_for_loop(task_ex):"},{"line_number":76,"context_line":"    capacity \u003d _get_context(task_ex)[_CAPACITY]"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    unaccepted \u003d _get_unaccepted_act_exs(task_ex)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    if unaccepted:"},{"line_number":81,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_14bb0cc6","line":78,"in_reply_to":"1a4dcd0f_42e41dab","updated":"2015-08-17 12:35:28.000000000","message":"ok","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"c77e6a64ff971b40296acebf5fc9a70ed6243a2c","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"def increase_capacity(task_ex):"},{"line_number":107,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":108,"context_line":"    max_concurrency \u003d task_ex.runtime_context.get(\u0027concurrency\u0027)"},{"line_number":109,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_44750d30","line":106,"updated":"2015-08-16 07:09:03.000000000","message":"do we need lock on this method and above one? If 2 actions finish at the same time, they will both increase/decrease capacity and update database. Could the db transaction protect this?","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"6748b5f7f622a7f74b516447fc038cf1fd98cd1e","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"def increase_capacity(task_ex):"},{"line_number":107,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":108,"context_line":"    max_concurrency \u003d task_ex.runtime_context.get(\u0027concurrency\u0027)"},{"line_number":109,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_c7427f68","line":106,"in_reply_to":"1a4dcd0f_44750d30","updated":"2015-08-16 08:00:14.000000000","message":"yep, it is already covered by _lock_workflow_execution method in default_engine.py: it tries to update workflow execution while other transaction will hang until first is finished.","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"205d08d996277f3ff7fdbb3ca20055a99b2f1c52","unresolved":false,"context_lines":[{"line_number":103,"context_line":"    task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"def increase_capacity(task_ex):"},{"line_number":107,"context_line":"    with_items_context \u003d _get_context(task_ex)"},{"line_number":108,"context_line":"    max_concurrency \u003d task_ex.runtime_context.get(\u0027concurrency\u0027)"},{"line_number":109,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a4dcd0f_624359b0","line":106,"in_reply_to":"1a4dcd0f_c7427f68","updated":"2015-08-16 09:00:22.000000000","message":"OK, so the more logic in db transaction, the worse performance in the scenario of many with-items...","commit_id":"ba50b5b8a59cb7d20d7e19e5de45fbf8f2b1e1bc"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"ce840f95a019043f9fab1475ad203eb7c7763e1f","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    if unaccepted:"},{"line_number":90,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    index \u003d get_index(task_ex)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_1911eb52","line":92,"updated":"2015-08-17 22:51:28.000000000","message":"What if len(indices[:capacity]) \u003c capacity? Is there still capacity - len(indices[:capacity]) that the engine can still run? Can you also include a unit test for this test case?","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":6732,"name":"Lingxian Kong","email":"anlin.kong@gmail.com","username":"kong"},"change_message_id":"78ae39afe13dffc7b1a63d4bb66bdf50c451e60d","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    if unaccepted:"},{"line_number":90,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    index \u003d get_index(task_ex)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_87bb45c4","line":92,"in_reply_to":"fa1b9901_1911eb52","updated":"2015-08-18 06:43:57.000000000","message":"Hmm, i think it\u0027s python feature and the result is obvious, if len(indices[:capacity]) \u003c capacity, it\u0027s indcies itself. I am ok with this. But it\u0027s up to Nikolay to decide whether to add a unit test :-)","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"6c6f7b6db4abf6cdea48b80a1245ac62813fe678","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    if unaccepted:"},{"line_number":90,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    index \u003d get_index(task_ex)"},{"line_number":95,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_ad5f4771","line":92,"in_reply_to":"fa1b9901_87bb45c4","updated":"2015-08-19 09:47:10.000000000","message":"Yep, Lingxian is right. if you have a list [1, 2, 3] and capacity\u003d4 then indices[:capacity] returns [1, 2, 3]. This is how slices work in python.","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"ce840f95a019043f9fab1475ad203eb7c7763e1f","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    action_exs +\u003d db_api.get_action_executions("},{"line_number":162,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":163,"context_line":"        state\u003dstates.RUNNING"},{"line_number":164,"context_line":"    )"},{"line_number":165,"context_line":""},{"line_number":166,"context_line":"    return get_count(task_ex) \u003e len(action_exs)"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_19948b89","line":164,"updated":"2015-08-17 22:51:28.000000000","message":"Does it make sense to use a filter like what you did above to get this list of action executions instead of two separate DB calls?\n\nexample: lambda x: x.accepted or x.state \u003d\u003d states.RUNNING","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"6c6f7b6db4abf6cdea48b80a1245ac62813fe678","unresolved":false,"context_lines":[{"line_number":161,"context_line":"    action_exs +\u003d db_api.get_action_executions("},{"line_number":162,"context_line":"        task_execution_id\u003dtask_ex.id,"},{"line_number":163,"context_line":"        state\u003dstates.RUNNING"},{"line_number":164,"context_line":"    )"},{"line_number":165,"context_line":""},{"line_number":166,"context_line":"    return get_count(task_ex) \u003e len(action_exs)"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_4ddc6be4","line":164,"in_reply_to":"fa1b9901_19948b89","updated":"2015-08-19 09:47:10.000000000","message":"yes, makes sense. Thanks for that catch!","commit_id":"96166fdf4ea727c8f68d794184ca19bf3d23cc6a"},{"author":{"_account_id":5558,"name":"Winson Chan","email":"wcchan@stackstorm.com","username":"winson-c-chan"},"change_message_id":"93a5fdf678a6954469868963943b38965298c95d","unresolved":false,"context_lines":[{"line_number":90,"context_line":"    if unaccepted:"},{"line_number":91,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    index \u003d get_index(task_ex)"},{"line_number":96,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"fa1b9901_73d25402","line":93,"updated":"2015-08-18 18:50:44.000000000","message":"Let\u0027s say I have 12 items in the with-items list. The concurrency is 3. On the first run, only 5 items are completed, 1 error and unaccepted, and 6 items unstarted. When the task is re-run, I expect the next batch to run the 1 unaccepted + 2 of the unstarted. But in this implementation here and for this use case, it seems only 1 unaccepted is restarted and the rest will have to wait until the next iteration?","commit_id":"4d6f8e6c490970ba7042b5a7561d86ba77894e4c"},{"author":{"_account_id":7700,"name":"Nikolay Mahotkin","email":"nikolay.makhotkin@gmail.com","username":"nmakhotkin"},"change_message_id":"08c1dae04c4e0ecc6295e49286371362ff324a39","unresolved":false,"context_lines":[{"line_number":90,"context_line":"    if unaccepted:"},{"line_number":91,"context_line":"        indices \u003d _get_indices_if_rerun(unaccepted)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        return indices[:capacity] if capacity else indices"},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    index \u003d get_index(task_ex)"},{"line_number":96,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"fa1b9901_6ae8f8b4","line":93,"in_reply_to":"fa1b9901_73d25402","updated":"2015-08-19 09:46:49.000000000","message":"Done","commit_id":"4d6f8e6c490970ba7042b5a7561d86ba77894e4c"}]}
