)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"e47ada86ef80154f0525148cd5b793062fdcf9e3","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Sundar Nadathur \u003csundar.nadathur@intel.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-03-10 21:27:59 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_3f847cd2","line":7,"range":{"start_line":7,"start_character":4,"end_line":7,"end_character":70},"updated":"2020-03-11 07:49:03.000000000","message":"Hi,Sundar. I want to know how much this situation exists, Could you give me an example?","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Sundar Nadathur \u003csundar.nadathur@intel.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2020-03-10 21:27:59 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_0f9e2854","line":7,"range":{"start_line":7,"start_character":4,"end_line":7,"end_character":70},"in_reply_to":"1fa4df85_3f847cd2","updated":"2020-03-11 21:06:41.000000000","message":"Please see the updated commit message.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"},{"line_number":11,"context_line":"instance, it must be ensured that the instance does not already have other"},{"line_number":12,"context_line":"ARQs bound to it. In the future, we may allow that for hot adds,"},{"line_number":13,"context_line":"but not now."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_dd220bbb","line":11,"range":{"start_line":10,"start_character":71,"end_line":11,"end_character":9},"updated":"2020-03-11 14:38:58.000000000","message":"a same instance (or server)","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"},{"line_number":11,"context_line":"instance, it must be ensured that the instance does not already have other"},{"line_number":12,"context_line":"ARQs bound to it. In the future, we may allow that for hot adds,"},{"line_number":13,"context_line":"but not now."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_398ac569","line":11,"range":{"start_line":10,"start_character":71,"end_line":11,"end_character":9},"in_reply_to":"1fa4df85_b203a7be","updated":"2020-03-24 23:12:58.000000000","message":"I personally find the term \u0027server\u0027 to be confusing. It could mean the instance/VM, or the physical host on which that instance is running. But, if others agree, we can discuss how to word this differently.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"5e547cb77f539f99cb715219cacccca404a0d4fd","unresolved":false,"context_lines":[{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"},{"line_number":11,"context_line":"instance, it must be ensured that the instance does not already have other"},{"line_number":12,"context_line":"ARQs bound to it. In the future, we may allow that for hot adds,"},{"line_number":13,"context_line":"but not now."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_b203a7be","line":11,"range":{"start_line":10,"start_character":71,"end_line":11,"end_character":9},"in_reply_to":"1fa4df85_d8752f34","updated":"2020-03-12 13:28:48.000000000","message":"I said the instance you point is a server, I would like use \u0027server\u0027 instead of \u0027instance\u0027, just a nit.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"WIP: Check during ARQ bind that the target instance has no other ARQs."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In the ARQ create/bind flow, new ARQs can be created for a device profile"},{"line_number":10,"context_line":"any time. However, if an attempt is made to bind those created ARQs to an"},{"line_number":11,"context_line":"instance, it must be ensured that the instance does not already have other"},{"line_number":12,"context_line":"ARQs bound to it. In the future, we may allow that for hot adds,"},{"line_number":13,"context_line":"but not now."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"1fa4df85_d8752f34","line":11,"range":{"start_line":10,"start_character":71,"end_line":11,"end_character":9},"in_reply_to":"1fa4df85_dd220bbb","updated":"2020-03-11 21:06:41.000000000","message":"Same as what?","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":15,"context_line":"Duplicate binds may be requested if the APIs are invoked directly, by an"},{"line_number":16,"context_line":"admin or a script. That is, the admin/script calls POST to create ARQs,"},{"line_number":17,"context_line":"then calls PATCH to bind them to some instance UUID, which happens to be"},{"line_number":18,"context_line":"an existing instance with ARQs. IOW, this is user error."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This can also arise in principle when an instance is rescheduled to another"},{"line_number":21,"context_line":"host by Nova -- though I haven\u0027t seen this in my testing. During"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1fa4df85_7781a1c3","line":18,"range":{"start_line":18,"start_character":32,"end_line":18,"end_character":35},"updated":"2020-03-12 13:27:34.000000000","message":"in other words?","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":15,"context_line":"Duplicate binds may be requested if the APIs are invoked directly, by an"},{"line_number":16,"context_line":"admin or a script. That is, the admin/script calls POST to create ARQs,"},{"line_number":17,"context_line":"then calls PATCH to bind them to some instance UUID, which happens to be"},{"line_number":18,"context_line":"an existing instance with ARQs. IOW, this is user error."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This can also arise in principle when an instance is rescheduled to another"},{"line_number":21,"context_line":"host by Nova -- though I haven\u0027t seen this in my testing. During"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1fa4df85_795d9d13","line":18,"range":{"start_line":18,"start_character":32,"end_line":18,"end_character":35},"in_reply_to":"1fa4df85_7781a1c3","updated":"2020-03-24 23:12:58.000000000","message":"Yes.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":17,"context_line":"then calls PATCH to bind them to some instance UUID, which happens to be"},{"line_number":18,"context_line":"an existing instance with ARQs. IOW, this is user error."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This can also arise in principle when an instance is rescheduled to another"},{"line_number":21,"context_line":"host by Nova -- though I haven\u0027t seen this in my testing. During"},{"line_number":22,"context_line":"rescheduling of an instance, Nova is expected to delete the bound ARQs"},{"line_number":23,"context_line":"for that instance before creating/binding ARQs to a different host. But"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1fa4df85_97869ddb","line":20,"range":{"start_line":20,"start_character":14,"end_line":20,"end_character":19},"updated":"2020-03-12 13:27:34.000000000","message":"s/arise/raise","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":17,"context_line":"then calls PATCH to bind them to some instance UUID, which happens to be"},{"line_number":18,"context_line":"an existing instance with ARQs. IOW, this is user error."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This can also arise in principle when an instance is rescheduled to another"},{"line_number":21,"context_line":"host by Nova -- though I haven\u0027t seen this in my testing. During"},{"line_number":22,"context_line":"rescheduling of an instance, Nova is expected to delete the bound ARQs"},{"line_number":23,"context_line":"for that instance before creating/binding ARQs to a different host. But"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1fa4df85_39a165f9","line":20,"range":{"start_line":20,"start_character":14,"end_line":20,"end_character":19},"in_reply_to":"1fa4df85_97869ddb","updated":"2020-03-24 23:12:58.000000000","message":"I did mean \u0027arise\u0027. I\u0027ll replace with \u0027happen\u0027.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":35,"context_line":"succeeds: but that is complex. Another option is to let the bind go"},{"line_number":36,"context_line":"through if the instance\u0027s ARQs are all in deleting state. But that still"},{"line_number":37,"context_line":"allows duplicate binds for some window of time till the deletions"},{"line_number":38,"context_line":"complete. This scenario may be rare enough that the simple solution of"},{"line_number":39,"context_line":"failing the duplicate bind is adequate."},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"Note that the Nova code deletes the created ARQs if bind fails during"},{"line_number":42,"context_line":"rescheduling:"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"1fa4df85_57ad852f","line":39,"range":{"start_line":38,"start_character":10,"end_line":39,"end_character":39},"updated":"2020-03-12 13:27:34.000000000","message":"Agree. If we wait for deletion complete, maybe that need too long time, and need some logical in Nova to monitor, it is complex.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":18,"context_line":"an existing instance with ARQs. IOW, this is user error."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This can also happen in principle when an instance is rescheduled to"},{"line_number":21,"context_line":"another host by Nova - but only in the future when ARQ deletions are"},{"line_number":22,"context_line":"made asynchronous. During rescheduling of an instance, Nova is expected"},{"line_number":23,"context_line":"to delete the bound ARQs for that instance before creating/binding ARQs"},{"line_number":24,"context_line":"to a different host. That is fine today because ARQ deletions are"},{"line_number":25,"context_line":"synchronous -- they complete before returning to the caller."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"df33271e_60147a4f","line":22,"range":{"start_line":21,"start_character":23,"end_line":22,"end_character":17},"updated":"2020-03-24 23:12:58.000000000","message":"Important new note.","commit_id":"a3c0f87b85019926ea1c36a485e459a0383ec27c"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"b8ff70bdec4e727898958c918e0e1385b47102e5","unresolved":false,"context_lines":[{"line_number":32,"context_line":"next bind call for rescheduling comes in. That is, the race"},{"line_number":33,"context_line":"scenario is like this:"},{"line_number":34,"context_line":"* Nova calls Cyborg to delete ARQs for an instance prior to rescheduling."},{"line_number":35,"context_line":"  Thw call returns while the deletion is still in progress."},{"line_number":36,"context_line":"* Nova calls Cyborg to create ARQs for a device profile. Since there is"},{"line_number":37,"context_line":"  no reference to any instance or host here, Cyborg has to satisfy this"},{"line_number":38,"context_line":"  request."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"df33271e_74c8bf54","line":35,"range":{"start_line":35,"start_character":2,"end_line":35,"end_character":5},"updated":"2020-03-25 00:31:57.000000000","message":"The","commit_id":"a3c0f87b85019926ea1c36a485e459a0383ec27c"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"4a4390b168217f3ea28807ad8c9d0ec600d83bf5","unresolved":false,"context_lines":[{"line_number":32,"context_line":"next bind call for rescheduling comes in. That is, the race"},{"line_number":33,"context_line":"scenario is like this:"},{"line_number":34,"context_line":"* Nova calls Cyborg to delete ARQs for an instance prior to rescheduling."},{"line_number":35,"context_line":"  Thw call returns while the deletion is still in progress."},{"line_number":36,"context_line":"* Nova calls Cyborg to create ARQs for a device profile. Since there is"},{"line_number":37,"context_line":"  no reference to any instance or host here, Cyborg has to satisfy this"},{"line_number":38,"context_line":"  request."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"df33271e_b1285186","line":35,"range":{"start_line":35,"start_character":2,"end_line":35,"end_character":5},"in_reply_to":"df33271e_74c8bf54","updated":"2020-03-28 17:42:44.000000000","message":"Done","commit_id":"a3c0f87b85019926ea1c36a485e459a0383ec27c"}],"cyborg/api/controllers/v2/arqs.py":[{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"e47ada86ef80154f0525148cd5b793062fdcf9e3","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                     if value is None]"},{"line_number":259,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027 and len(not_found) \u003e 0:"},{"line_number":260,"context_line":"            msg \u003d \u0027,\u0027.join(not_found)"},{"line_number":261,"context_line":"            reason \u003d _(\u0027Fields absent in patch {}\u0027).format(msg)"},{"line_number":262,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_3f7f9c66","line":261,"range":{"start_line":261,"start_character":21,"end_line":261,"end_character":22},"updated":"2020-03-11 07:49:03.000000000","message":"why we need to add this?","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"ffdc8257cbaa591beac35f896154e2cfa6d09e7f","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                     if value is None]"},{"line_number":259,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027 and len(not_found) \u003e 0:"},{"line_number":260,"context_line":"            msg \u003d \u0027,\u0027.join(not_found)"},{"line_number":261,"context_line":"            reason \u003d _(\u0027Fields absent in patch {}\u0027).format(msg)"},{"line_number":262,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_8474329e","line":261,"range":{"start_line":261,"start_character":21,"end_line":261,"end_character":22},"in_reply_to":"1fa4df85_2ff1a402","updated":"2020-03-12 02:19:06.000000000","message":"OK.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                     if value is None]"},{"line_number":259,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027 and len(not_found) \u003e 0:"},{"line_number":260,"context_line":"            msg \u003d \u0027,\u0027.join(not_found)"},{"line_number":261,"context_line":"            reason \u003d _(\u0027Fields absent in patch {}\u0027).format(msg)"},{"line_number":262,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_b845dd45","line":261,"range":{"start_line":261,"start_character":21,"end_line":261,"end_character":22},"in_reply_to":"1fa4df85_3f7f9c66","updated":"2020-03-11 14:38:58.000000000","message":"I know we can do this way, but I don\u0027t know what are the advantages of using \"i18n\" like this, if Sundar can give some given some explanations, I think I would be very grateful.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                     if value is None]"},{"line_number":259,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027 and len(not_found) \u003e 0:"},{"line_number":260,"context_line":"            msg \u003d \u0027,\u0027.join(not_found)"},{"line_number":261,"context_line":"            reason \u003d _(\u0027Fields absent in patch {}\u0027).format(msg)"},{"line_number":262,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_2ff1a402","line":261,"range":{"start_line":261,"start_character":21,"end_line":261,"end_character":22},"in_reply_to":"1fa4df85_b845dd45","updated":"2020-03-11 21:06:41.000000000","message":"This is meant for internationalization. That is, the strings can be translated to other languages. This is done only for exception messages, which are visible to users, not for logs. Other projects like Nova do this too.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"56637adaefe2cc4cfff3925a7baa4383926a3c6a","unresolved":false,"context_lines":[{"line_number":266,"context_line":"    def _check_if_already_bound(self, context, valid_fields):"},{"line_number":267,"context_line":"        patch_fields \u003d list(valid_fields.values())[0]"},{"line_number":268,"context_line":"        instance_uuid \u003d patch_fields[\u0027instance_uuid\u0027]"},{"line_number":269,"context_line":"        extarqs \u003d objects.ExtARQ.list(context)"},{"line_number":270,"context_line":"        extarqs_for_instance \u003d ["},{"line_number":271,"context_line":"            extarq for extarq in extarqs"},{"line_number":272,"context_line":"            if extarq.arq[\u0027instance_uuid\u0027] \u003d\u003d instance_uuid]"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_6366e22c","line":269,"range":{"start_line":269,"start_character":18,"end_line":269,"end_character":37},"updated":"2020-03-11 09:07:23.000000000","message":"This method should be mocked. Now this method return [].\nI guess that\u0027s why the assert Failed.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":266,"context_line":"    def _check_if_already_bound(self, context, valid_fields):"},{"line_number":267,"context_line":"        patch_fields \u003d list(valid_fields.values())[0]"},{"line_number":268,"context_line":"        instance_uuid \u003d patch_fields[\u0027instance_uuid\u0027]"},{"line_number":269,"context_line":"        extarqs \u003d objects.ExtARQ.list(context)"},{"line_number":270,"context_line":"        extarqs_for_instance \u003d ["},{"line_number":271,"context_line":"            extarq for extarq in extarqs"},{"line_number":272,"context_line":"            if extarq.arq[\u0027instance_uuid\u0027] \u003d\u003d instance_uuid]"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_4fcf40b0","line":269,"range":{"start_line":269,"start_character":18,"end_line":269,"end_character":37},"in_reply_to":"1fa4df85_6366e22c","updated":"2020-03-11 21:06:41.000000000","message":"It was mocked in the test cases that failed. I did it differently in next PS.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":271,"context_line":"            extarq for extarq in extarqs"},{"line_number":272,"context_line":"            if extarq.arq[\u0027instance_uuid\u0027] \u003d\u003d instance_uuid]"},{"line_number":273,"context_line":"        if extarqs_for_instance:  # duplicate binding request"},{"line_number":274,"context_line":"            msg \u003d _(\u0027Instance {} already has accelerator requests.\u0027"},{"line_number":275,"context_line":"                    \u0027Cannot bind additional ARQs.\u0027)"},{"line_number":276,"context_line":"            reason \u003d msg.format(instance_uuid)"},{"line_number":277,"context_line":"            raise exception.PatchError(reason\u003dreason)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_f86ef594","line":274,"range":{"start_line":274,"start_character":66,"end_line":274,"end_character":67},"updated":"2020-03-11 14:38:58.000000000","message":"Here need to add a white space.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":271,"context_line":"            extarq for extarq in extarqs"},{"line_number":272,"context_line":"            if extarq.arq[\u0027instance_uuid\u0027] \u003d\u003d instance_uuid]"},{"line_number":273,"context_line":"        if extarqs_for_instance:  # duplicate binding request"},{"line_number":274,"context_line":"            msg \u003d _(\u0027Instance {} already has accelerator requests.\u0027"},{"line_number":275,"context_line":"                    \u0027Cannot bind additional ARQs.\u0027)"},{"line_number":276,"context_line":"            reason \u003d msg.format(instance_uuid)"},{"line_number":277,"context_line":"            raise exception.PatchError(reason\u003dreason)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_58cfff28","line":274,"range":{"start_line":274,"start_character":66,"end_line":274,"end_character":67},"in_reply_to":"1fa4df85_f86ef594","updated":"2020-03-11 21:06:41.000000000","message":"Done","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":274,"context_line":"            msg \u003d _(\u0027Instance {} already has accelerator requests.\u0027"},{"line_number":275,"context_line":"                    \u0027Cannot bind additional ARQs.\u0027)"},{"line_number":276,"context_line":"            reason \u003d msg.format(instance_uuid)"},{"line_number":277,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    @policy.authorize_wsgi(\"cyborg:arq\", \"update\", False)"},{"line_number":280,"context_line":"    @expose.expose(None, body\u003dtypes.jsontype,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_8c2b0681","line":277,"range":{"start_line":277,"start_character":12,"end_line":277,"end_character":53},"updated":"2020-03-11 14:38:58.000000000","message":"Need a test case, in that case we can assertIn(\u0027Cannot bind additional ARQs.\u0027, *response*), to ensure our msg return is right.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":274,"context_line":"            msg \u003d _(\u0027Instance {} already has accelerator requests.\u0027"},{"line_number":275,"context_line":"                    \u0027Cannot bind additional ARQs.\u0027)"},{"line_number":276,"context_line":"            reason \u003d msg.format(instance_uuid)"},{"line_number":277,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    @policy.authorize_wsgi(\"cyborg:arq\", \"update\", False)"},{"line_number":280,"context_line":"    @expose.expose(None, body\u003dtypes.jsontype,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_78d43bbe","line":277,"range":{"start_line":277,"start_character":12,"end_line":277,"end_character":53},"in_reply_to":"1fa4df85_8c2b0681","updated":"2020-03-11 21:06:41.000000000","message":"Done","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":305,"context_line":""},{"line_number":306,"context_line":"        # For bind requests, ensure no ARQs are already associated with"},{"line_number":307,"context_line":"        # the instance. This is needed to prevent new ARQs from being"},{"line_number":308,"context_line":"        # bound to existing instances."},{"line_number":309,"context_line":"        patch \u003d list(patch_list.values())[0]"},{"line_number":310,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027:"},{"line_number":311,"context_line":"            self._check_if_already_bound(context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_b8c07d2c","line":308,"range":{"start_line":308,"start_character":19,"end_line":308,"end_character":38},"updated":"2020-03-11 14:38:58.000000000","message":"It seems like to say: ..bound to an existing instance.\n\nThat we can bound to more than once? From _check_if_already_bound(), I think that one server maybe has two ARQs (Line 272), but one ARQ cannot belong to more than one server.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":305,"context_line":""},{"line_number":306,"context_line":"        # For bind requests, ensure no ARQs are already associated with"},{"line_number":307,"context_line":"        # the instance. This is needed to prevent new ARQs from being"},{"line_number":308,"context_line":"        # bound to existing instances."},{"line_number":309,"context_line":"        patch \u003d list(patch_list.values())[0]"},{"line_number":310,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027:"},{"line_number":311,"context_line":"            self._check_if_already_bound(context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_8f63f8b1","line":308,"range":{"start_line":308,"start_character":19,"end_line":308,"end_character":38},"in_reply_to":"1fa4df85_b8c07d2c","updated":"2020-03-11 21:06:41.000000000","message":"\u003e It seems like to say: ..bound to an existing instance.\n\nWill change.\n\n \u003e That we can bound to more than once? From _check_if_already_bound(),\n \u003e I think that one server maybe has two ARQs (Line 272), but one ARQ\n \u003e cannot belong to more than one server.\n\nTrue. However, if an instance already exists with some ARQs bound to it, and newly created ARQs are requested to be bound to that existing instance, that request should be errored out. That is what we are doing here.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"    @staticmethod"},{"line_number":267,"context_line":"    def _check_if_already_bound(context, valid_fields):"},{"line_number":268,"context_line":"        patch_fields \u003d list(valid_fields.values())[0]"},{"line_number":269,"context_line":"        instance_uuid \u003d patch_fields[\u0027instance_uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_172aad8f","line":266,"range":{"start_line":266,"start_character":4,"end_line":266,"end_character":17},"updated":"2020-03-12 13:27:34.000000000","message":"Is this necessary? I think this function just only used in PATCH ARQ API, that can we remove this decorator?","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"dd3de3993b98f8cecd282f04ad3df7fe22eb8894","unresolved":false,"context_lines":[{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"    @staticmethod"},{"line_number":267,"context_line":"    def _check_if_already_bound(context, valid_fields):"},{"line_number":268,"context_line":"        patch_fields \u003d list(valid_fields.values())[0]"},{"line_number":269,"context_line":"        instance_uuid \u003d patch_fields[\u0027instance_uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_19b59b32","line":266,"range":{"start_line":266,"start_character":4,"end_line":266,"end_character":17},"in_reply_to":"1fa4df85_172aad8f","updated":"2020-03-19 12:23:57.000000000","message":"Hi Brin. IMO, this can be a static method since _check_if_already_bound function has nothing to do with the class instance.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        return valid_fields"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"    @staticmethod"},{"line_number":267,"context_line":"    def _check_if_already_bound(context, valid_fields):"},{"line_number":268,"context_line":"        patch_fields \u003d list(valid_fields.values())[0]"},{"line_number":269,"context_line":"        instance_uuid \u003d patch_fields[\u0027instance_uuid\u0027]"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_d9a131f9","line":266,"range":{"start_line":266,"start_character":4,"end_line":266,"end_character":17},"in_reply_to":"1fa4df85_19b59b32","updated":"2020-03-24 23:12:58.000000000","message":"Exactly. This function acts only on its parameters and not on any class/object member fields.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"dd3de3993b98f8cecd282f04ad3df7fe22eb8894","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        for arq_uuid, patch in patch_list.items():"},{"line_number":305,"context_line":"            valid_fields[arq_uuid] \u003d self._validate_arq_patch(patch)"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"        # For bind requests, ensure no ARQs are already associated with"},{"line_number":308,"context_line":"        # the instance. This is needed to prevent new ARQs from being"},{"line_number":309,"context_line":"        # bound to an existing instance with ARQs."},{"line_number":310,"context_line":"        patch \u003d list(patch_list.values())[0]"},{"line_number":311,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027:"},{"line_number":312,"context_line":"            self._check_if_already_bound(context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_f668cef5","line":309,"range":{"start_line":307,"start_character":0,"end_line":309,"end_character":50},"updated":"2020-03-19 12:23:57.000000000","message":"Hi Sundar, I think we need more description here to show why we need _check_if_already_bound now and what will need to be done(maybe TODOs) in the future, that\u0027s important for quick understanding the check here.\nJust putting the first paragraph of the commit message here also makes sense.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        for arq_uuid, patch in patch_list.items():"},{"line_number":305,"context_line":"            valid_fields[arq_uuid] \u003d self._validate_arq_patch(patch)"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"        # For bind requests, ensure no ARQs are already associated with"},{"line_number":308,"context_line":"        # the instance. This is needed to prevent new ARQs from being"},{"line_number":309,"context_line":"        # bound to an existing instance with ARQs."},{"line_number":310,"context_line":"        patch \u003d list(patch_list.values())[0]"},{"line_number":311,"context_line":"        if patch[0][\u0027op\u0027] \u003d\u003d \u0027add\u0027:"},{"line_number":312,"context_line":"            self._check_if_already_bound(context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"df33271e_6f664f54","line":309,"range":{"start_line":307,"start_character":0,"end_line":309,"end_character":50},"in_reply_to":"1fa4df85_f668cef5","updated":"2020-03-24 23:12:58.000000000","message":"Done","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"e4ef4dc60cc1563e292f5c768133c69f3aa14bf6","unresolved":false,"context_lines":[{"line_number":274,"context_line":"        if extarqs_for_instance:  # duplicate binding request"},{"line_number":275,"context_line":"            msg \u003d _(\u0027Instance {} already has accelerator requests. \u0027"},{"line_number":276,"context_line":"                    \u0027Cannot bind additional ARQs.\u0027)"},{"line_number":277,"context_line":"            reason \u003d msg.format(instance_uuid)"},{"line_number":278,"context_line":"            raise exception.PatchError(reason\u003dreason)"},{"line_number":279,"context_line":""},{"line_number":280,"context_line":"    @policy.authorize_wsgi(\"cyborg:arq\", \"update\", False)"}],"source_content_type":"text/x-python","patch_set":4,"id":"df33271e_ac484fcc","line":277,"range":{"start_line":277,"start_character":12,"end_line":277,"end_character":46},"updated":"2020-03-24 03:58:07.000000000","message":"nit: Instead of format the msg, we can do:\nmsg \u003d _(\u0027Instance %s already has accelerator requests. \u0027\n        \u0027Cannot bind additional ARQs.\u0027) % instance_uuid","commit_id":"2b54bac1311fe1b8dfd41dae44bb119524f7c61a"}],"cyborg/tests/unit/api/controllers/v2/test_arqs.py":[{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                \u0027instance_uuid\u0027: \u002752a53fbe-2fd3-46ad-aac2-65160b977ad4\u0027}"},{"line_number":165,"context_line":"            for arq_uuid in arq_uuids}"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"        self.patch_json(self.ARQ_URL, params\u003dpatch_list,"},{"line_number":168,"context_line":"                        headers\u003dself.headers)"},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"        mock_apply_patch.assert_called_once_with(mock.ANY, patch_list,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_38ed6d8b","line":167,"updated":"2020-03-11 14:38:58.000000000","message":"respones \u003d self.patch_json() that seems like all the needed data comes from fake, and so that it is difficult for us to get the exception we want, maybe we should judge response.http_code?\n\nIndeed, we need to test the PatchError exception. I would like to assertIn(\u0027part of failed reason\u0027, in response.message), response.message is the failed reason we raised.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                \u0027instance_uuid\u0027: \u002752a53fbe-2fd3-46ad-aac2-65160b977ad4\u0027}"},{"line_number":165,"context_line":"            for arq_uuid in arq_uuids}"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"        self.patch_json(self.ARQ_URL, params\u003dpatch_list,"},{"line_number":168,"context_line":"                        headers\u003dself.headers)"},{"line_number":169,"context_line":""},{"line_number":170,"context_line":"        mock_apply_patch.assert_called_once_with(mock.ANY, patch_list,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_98bc976d","line":167,"in_reply_to":"1fa4df85_38ed6d8b","updated":"2020-03-11 21:06:41.000000000","message":"This test case is not meant to test the exception. It is the happy path, where everything works fine. I\u0027ll add test cases for the exception.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"dd3de3993b98f8cecd282f04ad3df7fe22eb8894","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    @mock.patch.object(ARQsController, \u0027_check_if_already_bound\u0027)"},{"line_number":159,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.apply_patch\u0027)"},{"line_number":160,"context_line":"    def test_apply_patch(self, mock_apply_patch, mock_check_if_bound):"},{"line_number":161,"context_line":"        \"\"\"Test the happy path.\"\"\""},{"line_number":162,"context_line":"        patch_list \u003d fake_extarq.get_patch_list()"},{"line_number":163,"context_line":"        arq_uuids \u003d list(patch_list.keys())"},{"line_number":164,"context_line":"        valid_fields \u003d {"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_f9651fb6","line":161,"range":{"start_line":161,"start_character":26,"end_line":161,"end_character":30},"updated":"2020-03-19 12:23:57.000000000","message":"nit:patch","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"36512338bd6babbdd34cb0c1f4b5bceb22fe626b","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    @mock.patch.object(ARQsController, \u0027_check_if_already_bound\u0027)"},{"line_number":159,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.apply_patch\u0027)"},{"line_number":160,"context_line":"    def test_apply_patch(self, mock_apply_patch, mock_check_if_bound):"},{"line_number":161,"context_line":"        \"\"\"Test the happy path.\"\"\""},{"line_number":162,"context_line":"        patch_list \u003d fake_extarq.get_patch_list()"},{"line_number":163,"context_line":"        arq_uuids \u003d list(patch_list.keys())"},{"line_number":164,"context_line":"        valid_fields \u003d {"}],"source_content_type":"text/x-python","patch_set":3,"id":"df33271e_67e0f8fb","line":161,"range":{"start_line":161,"start_character":26,"end_line":161,"end_character":30},"in_reply_to":"1fa4df85_598ea179","updated":"2020-03-26 03:07:31.000000000","message":"aha!\nok.got that.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":158,"context_line":"    @mock.patch.object(ARQsController, \u0027_check_if_already_bound\u0027)"},{"line_number":159,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.apply_patch\u0027)"},{"line_number":160,"context_line":"    def test_apply_patch(self, mock_apply_patch, mock_check_if_bound):"},{"line_number":161,"context_line":"        \"\"\"Test the happy path.\"\"\""},{"line_number":162,"context_line":"        patch_list \u003d fake_extarq.get_patch_list()"},{"line_number":163,"context_line":"        arq_uuids \u003d list(patch_list.keys())"},{"line_number":164,"context_line":"        valid_fields \u003d {"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_598ea179","line":161,"range":{"start_line":161,"start_character":26,"end_line":161,"end_character":30},"in_reply_to":"1fa4df85_f9651fb6","updated":"2020-03-24 23:12:58.000000000","message":"I did mean \u0027path\u0027. This is testing the code path where everything works as expected, with no errors. That is the \u0027happy path.\u0027","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"dd3de3993b98f8cecd282f04ad3df7fe22eb8894","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        mock_apply_patch.assert_called_once_with(mock.ANY, patch_list,"},{"line_number":175,"context_line":"                                                 valid_fields)"},{"line_number":176,"context_line":"        mock_check_if_bound.assert_called_once_with(mock.ANY, valid_fields)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    # TODO(all): Add exception test cases for apply_patch."},{"line_number":179,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_3cb2c54a","line":176,"range":{"start_line":176,"start_character":7,"end_line":176,"end_character":75},"updated":"2020-03-19 12:23:57.000000000","message":"Should we also check assertEqual(0, len(list(extarqs_for_instance)) for happy patch, check assertEqual(1, len(list(extarqs_for_instance)) for unhappy patch?","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        mock_apply_patch.assert_called_once_with(mock.ANY, patch_list,"},{"line_number":175,"context_line":"                                                 valid_fields)"},{"line_number":176,"context_line":"        mock_check_if_bound.assert_called_once_with(mock.ANY, valid_fields)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    # TODO(all): Add exception test cases for apply_patch."},{"line_number":179,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_791b5dc9","line":176,"range":{"start_line":176,"start_character":7,"end_line":176,"end_character":75},"in_reply_to":"1fa4df85_3cb2c54a","updated":"2020-03-24 23:12:58.000000000","message":"Asserting for that means that the code path ensures the condition that are no extarqs for the instance. But it is the other way around: if there are no other extarqs for the instance, then the code will follow the happy path.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"36512338bd6babbdd34cb0c1f4b5bceb22fe626b","unresolved":false,"context_lines":[{"line_number":173,"context_line":""},{"line_number":174,"context_line":"        mock_apply_patch.assert_called_once_with(mock.ANY, patch_list,"},{"line_number":175,"context_line":"                                                 valid_fields)"},{"line_number":176,"context_line":"        mock_check_if_bound.assert_called_once_with(mock.ANY, valid_fields)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    # TODO(all): Add exception test cases for apply_patch."},{"line_number":179,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"df33271e_c7b10492","line":176,"range":{"start_line":176,"start_character":7,"end_line":176,"end_character":75},"in_reply_to":"1fa4df85_791b5dc9","updated":"2020-03-26 03:07:31.000000000","message":"ok, I\u0027m convinced. let\u0027s just keep as it is.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":192,"context_line":"                \u0027instance_uuid\u0027: instance_uuid}"},{"line_number":193,"context_line":"            for extarq in extarqs}"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        ARQsController._check_if_already_bound(self.context, valid_fields)"},{"line_number":196,"context_line":"        mock_extarq_list.assert_called_once_with(self.context)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.list\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_d250a30d","line":195,"range":{"start_line":195,"start_character":8,"end_line":195,"end_character":22},"updated":"2020-03-12 13:27:34.000000000","message":"We can init this in setUp(), such as:\nself.arq_controller \u003d ARQsController.ARQsController()\nthan use self.arq_controller to call it\u0027s functions.\nself.arq_controller._check_if_already_bound(self.context, valid_fields)","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":192,"context_line":"                \u0027instance_uuid\u0027: instance_uuid}"},{"line_number":193,"context_line":"            for extarq in extarqs}"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        ARQsController._check_if_already_bound(self.context, valid_fields)"},{"line_number":196,"context_line":"        mock_extarq_list.assert_called_once_with(self.context)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.list\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_f9366d51","line":195,"range":{"start_line":195,"start_character":8,"end_line":195,"end_character":22},"in_reply_to":"1fa4df85_d250a30d","updated":"2020-03-24 23:12:58.000000000","message":"I am not sure what is the benefit of doing that. But I did it anyway.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"b8ff70bdec4e727898958c918e0e1385b47102e5","unresolved":false,"context_lines":[{"line_number":192,"context_line":"                \u0027instance_uuid\u0027: instance_uuid}"},{"line_number":193,"context_line":"            for extarq in extarqs}"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        ARQsController._check_if_already_bound(self.context, valid_fields)"},{"line_number":196,"context_line":"        mock_extarq_list.assert_called_once_with(self.context)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.list\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"df33271e_34bd9765","line":195,"range":{"start_line":195,"start_character":8,"end_line":195,"end_character":22},"in_reply_to":"1fa4df85_f9366d51","updated":"2020-03-25 00:31:57.000000000","message":"IMO, it is a re-used object, which performs initialization calls, which greatly improves performance. Another, it is also easier to maintain.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.list\u0027)"},{"line_number":199,"context_line":"    def test_check_if_bound_exception(self, mock_extarq_list):"},{"line_number":200,"context_line":"        \"\"\"Test that, if binding request specifies an instance with ARQs,"},{"line_number":201,"context_line":"           an exception is raised."},{"line_number":202,"context_line":"        \"\"\""},{"line_number":203,"context_line":"        extarqs \u003d fake_extarq.get_fake_extarq_objs()"},{"line_number":204,"context_line":"        mock_extarq_list.return_value \u003d extarqs"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_d2874361","line":201,"range":{"start_line":200,"start_character":11,"end_line":201,"end_character":34},"updated":"2020-03-12 13:27:34.000000000","message":"I am not an expert in EN, just look this is not easy to understand. How about \"Test exception of PatchError because of binding request specifies an instance with ARQs.\"","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    @mock.patch(\u0027cyborg.objects.ExtARQ.list\u0027)"},{"line_number":199,"context_line":"    def test_check_if_bound_exception(self, mock_extarq_list):"},{"line_number":200,"context_line":"        \"\"\"Test that, if binding request specifies an instance with ARQs,"},{"line_number":201,"context_line":"           an exception is raised."},{"line_number":202,"context_line":"        \"\"\""},{"line_number":203,"context_line":"        extarqs \u003d fake_extarq.get_fake_extarq_objs()"},{"line_number":204,"context_line":"        mock_extarq_list.return_value \u003d extarqs"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_993f3924","line":201,"range":{"start_line":200,"start_character":11,"end_line":201,"end_character":34},"in_reply_to":"1fa4df85_d2874361","updated":"2020-03-24 23:12:58.000000000","message":"Ok, I have reworded this.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        self.assertRaisesRegex("},{"line_number":216,"context_line":"            exception.PatchError,"},{"line_number":217,"context_line":"            \u0027already has accelerator requests. Cannot bind additional ARQs.\u0027,"},{"line_number":218,"context_line":"            ARQsController._check_if_already_bound,"},{"line_number":219,"context_line":"            self.context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_72ca0fa2","line":217,"updated":"2020-03-12 13:27:34.000000000","message":"+1, this look like we test abnormal scenarios.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"dd3de3993b98f8cecd282f04ad3df7fe22eb8894","unresolved":false,"context_lines":[{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        self.assertRaisesRegex("},{"line_number":216,"context_line":"            exception.PatchError,"},{"line_number":217,"context_line":"            \u0027already has accelerator requests. Cannot bind additional ARQs.\u0027,"},{"line_number":218,"context_line":"            ARQsController._check_if_already_bound,"},{"line_number":219,"context_line":"            self.context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_7974cfcf","line":217,"range":{"start_line":217,"start_character":1,"end_line":217,"end_character":77},"updated":"2020-03-19 12:23:57.000000000","message":"should the message accurately the same as           msg \u003d _(\u0027Instance {} already has accelerator requests. \u0027\n                    \u0027Cannot bind additional ARQs.\u0027)","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        self.assertRaisesRegex("},{"line_number":216,"context_line":"            exception.PatchError,"},{"line_number":217,"context_line":"            \u0027already has accelerator requests. Cannot bind additional ARQs.\u0027,"},{"line_number":218,"context_line":"            ARQsController._check_if_already_bound,"},{"line_number":219,"context_line":"            self.context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"df33271e_326030cf","line":217,"range":{"start_line":217,"start_character":1,"end_line":217,"end_character":77},"in_reply_to":"1fa4df85_7974cfcf","updated":"2020-03-24 23:12:58.000000000","message":"Done","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"20f28273a4d6ff927c8e683ebc4ae847b533c8f9","unresolved":false,"context_lines":[{"line_number":215,"context_line":"        self.assertRaisesRegex("},{"line_number":216,"context_line":"            exception.PatchError,"},{"line_number":217,"context_line":"            \u0027already has accelerator requests. Cannot bind additional ARQs.\u0027,"},{"line_number":218,"context_line":"            ARQsController._check_if_already_bound,"},{"line_number":219,"context_line":"            self.context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_72f1af01","line":218,"range":{"start_line":218,"start_character":12,"end_line":218,"end_character":26},"updated":"2020-03-12 13:27:34.000000000","message":"ditto.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"23eb41a1e87961814780069c0d1c2bfc6749f3b6","unresolved":false,"context_lines":[{"line_number":215,"context_line":"        self.assertRaisesRegex("},{"line_number":216,"context_line":"            exception.PatchError,"},{"line_number":217,"context_line":"            \u0027already has accelerator requests. Cannot bind additional ARQs.\u0027,"},{"line_number":218,"context_line":"            ARQsController._check_if_already_bound,"},{"line_number":219,"context_line":"            self.context, valid_fields)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1fa4df85_b93c752f","line":218,"range":{"start_line":218,"start_character":12,"end_line":218,"end_character":26},"in_reply_to":"1fa4df85_72f1af01","updated":"2020-03-24 23:12:58.000000000","message":"Same as previous response.","commit_id":"6d508affe66d72da4e2d91bfea2062ca198f4f93"}],"cyborg/tests/unit/fake_extarq.py":[{"author":{"_account_id":26458,"name":"Brin Zhang","email":"zhangbailin@inspur.com","username":"zhangbailin"},"change_message_id":"ebe549ba1bbb5a280a05ae724286d7fcb729e8b7","unresolved":false,"context_lines":[{"line_number":130,"context_line":"    return get_fake_db_extarqs()[1:]"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"def get_patch_list(same_device\u003dTrue):"},{"line_number":134,"context_line":"    \"\"\"Returns a list of bindings for many ARQs."},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    :param same_device: Flag that the returned bindings for all ARQs"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_f808352e","line":133,"updated":"2020-03-11 14:38:58.000000000","message":"As I said before, all the needed data comes from fake, can we mock mainly function in the API, and run the run real of the code to test our case? such as PatchError, that we can fake needed data, and raise PatchError caused by the same server wants bound to another ARQ.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"fdf752bb1e8747409a9d3068d037b9d5f4b6aa6a","unresolved":false,"context_lines":[{"line_number":130,"context_line":"    return get_fake_db_extarqs()[1:]"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"def get_patch_list(same_device\u003dTrue):"},{"line_number":134,"context_line":"    \"\"\"Returns a list of bindings for many ARQs."},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    :param same_device: Flag that the returned bindings for all ARQs"}],"source_content_type":"text/x-python","patch_set":1,"id":"1fa4df85_18b0a78b","line":133,"in_reply_to":"1fa4df85_f808352e","updated":"2020-03-11 21:06:41.000000000","message":"Please see next PS.","commit_id":"6461992df6cb4b3d4cd368f7d699bd6f3e134dbc"}]}
