)]}'
{"ironic_inspector/common/ironic.py":[{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"1b6b39db218bc7402cfd8c2753235c75a36e463e","unresolved":true,"context_lines":[{"line_number":237,"context_line":"        return nodes.pop()"},{"line_number":238,"context_line":""},{"line_number":239,"context_line":""},{"line_number":240,"context_line":"def _wait_for_node(nodes):"},{"line_number":241,"context_line":"    inspection_delay \u003d 5"},{"line_number":242,"context_line":"    \"\"\"Wait for the node\u0027s turn to be inspected.\"\"\""},{"line_number":243,"context_line":"    global _LAST_INSPECTION_TIME"},{"line_number":244,"context_line":""},{"line_number":245,"context_line":"    LOG.debug(\u0027Attempting to acquire lock on last inspection time\u0027,"},{"line_number":246,"context_line":"              nodes\u003dnodes)"},{"line_number":247,"context_line":"    with _LAST_INSPECTION_LOCK:"},{"line_number":248,"context_line":"        delay \u003d (_LAST_INSPECTION_TIME - time.time()"},{"line_number":249,"context_line":"                 + inspection_delay)"},{"line_number":250,"context_line":"        if delay \u003e 0:"},{"line_number":251,"context_line":"            LOG.debug(\u0027Waiting %d seconds before sending the next \u0027"},{"line_number":252,"context_line":"                      \u0027node for inspection\u0027, delay, nodes\u003dnodes)"},{"line_number":253,"context_line":"            time.sleep(delay)"},{"line_number":254,"context_line":"        _LAST_INSPECTION_TIME \u003d time.time()"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"def lookup_node_by_bmc_addresses(addresses, introspection_data\u003dNone,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5de13f60_4c8ea8fe","line":254,"range":{"start_line":240,"start_character":1,"end_line":254,"end_character":43},"updated":"2021-08-10 15:25:17.000000000","message":"So instead of using locks and splitting a API query by 5 seconds, why not keep an internal cache that we check first from the last time we queried Ironic for the same information. If the node matches, we avoid a query. If we got it in a previous update, it matches. And *then* wrap the actual act of getting the updated list with a lock","commit_id":"b1da1aeafb743b4b7ca54922174b10399b3c9cb9"},{"author":{"_account_id":11655,"name":"Julia Kreger","email":"juliaashleykreger@gmail.com","username":"jkreger","status":"Flying to the moon with a Jetpack!"},"change_message_id":"1b6b39db218bc7402cfd8c2753235c75a36e463e","unresolved":true,"context_lines":[{"line_number":266,"context_line":"    #                 inspected, i.e. inspect wait, and then fallback"},{"line_number":267,"context_line":"    #                 to the rest of the physical nodes so we limit"},{"line_number":268,"context_line":"    #                 overall-impact of the operation."},{"line_number":269,"context_line":"    nodes \u003d ironic.nodes(fields\u003d(\u0027uuid\u0027, \u0027driver_info\u0027), limit\u003dNone)"},{"line_number":270,"context_line":"    _wait_for_node(nodes)"},{"line_number":271,"context_line":"    found \u003d set()"},{"line_number":272,"context_line":"    for node in nodes:"}],"source_content_type":"text/x-python","patch_set":1,"id":"43ba4dd4_4314f517","line":269,"range":{"start_line":269,"start_character":0,"end_line":269,"end_character":68},"updated":"2021-08-10 15:25:17.000000000","message":"Based on prior comment, maybe lock just this act so only one can occur at one time, and *then* extend it to support an internal in-memory cache which may have just been updated. That way we only do the lookup when we absolutely need to..\n\n*additionally* and I think this is more in-line with the original story. The provision_state can be queried againstiwth Ironic\u0027s API[0]. This column in ironic\u0027s database *is* indexed, so performing a lookup against an indexed subset will make the overall query return *much* faster. This is likely mutually exclusive from my other idea though. Just a thought.\n\n[0]:https://docs.openstack.org/api-ref/baremetal/?expanded\u003dlist-nodes-detail","commit_id":"b1da1aeafb743b4b7ca54922174b10399b3c9cb9"}]}
