You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll be taking specifically about Chrome infra bot_config.py case, as a primary example.
Here's how it works:
bot_config.get_dimensions and bot_config.get_state are called with bot.Bot object that has id == 'none' (and the rest of the properties missing). bot_config.get_dimensions is actually using android.get_devices, but Android subsystem hasn't been initialized yet (because it is initialized in on_bot_startup), and so initial dimensions and state are bogus.
Then on_bot_startup is called. It assumes bot.Bot object already has dimensions set (which are set to possibly bogus values, since Android subsystem hasn't been initialized yet). It initializes Android subsystem.
bot_config.get_dimensions and bot_config.get_state are called again. Now with correct bot.Bot object and correct Android subsystem state.
Finally /handshake endpoint is called, it receives correct dimensions and state.
I'm now trying to return additional data from /handshake, that can be used in get_dimensions to make decisions. Unfortunately, get_dimensions is called twice in different circumstances even before /handshake is called. Adding third flavor of environment in which get_dimensions is called is too much.
Proposal:
Postulate that on_bot_startup is called before any other hook (including before get_dimensions).
Document that on_bot_startup receives special uninitialized bot.Bot object.
Teach on_bot_startup to return bot ID, initial set of dimensions and state, send them to the /handshake.
Document that /handshake receives initial dimensions and state that may be changed in the future by get_dimensions and get_state.
Document that get_dimensions and get_state are called immediately before /poll (e.g. after all initialization and initial handshake).
Forbid ID dimension to be changed by get_dimensions (bot changing its ID midlife doesn't make much sense).
The new flow then would be:
on_bot_startup is called (with bot.Bot.id == 'none'), it initializes Android subsystem and bot ID and initial dimensions and state.
/handshake is called. It may return additional server-supplied data, fetched based on bot's ID.
get_dimensions and get_state are called. They may use state set up in on_bot_startup and data returned by /handshake.
/poll
The text was updated successfully, but these errors were encountered:
Bot startup process is messy.
I'll be taking specifically about Chrome infra bot_config.py case, as a primary example.
Here's how it works:
bot_config.get_dimensions
andbot_config.get_state
are called with bot.Bot object that has id == 'none' (and the rest of the properties missing).bot_config.get_dimensions
is actually usingandroid.get_devices
, but Android subsystem hasn't been initialized yet (because it is initialized inon_bot_startup
), and so initialdimensions
andstate
are bogus.on_bot_startup
is called. It assumes bot.Bot object already has dimensions set (which are set to possibly bogus values, since Android subsystem hasn't been initialized yet). It initializes Android subsystem.bot_config.get_dimensions
andbot_config.get_state
are called again. Now with correct bot.Bot object and correct Android subsystem state./handshake
endpoint is called, it receives correct dimensions and state.This is at least very confusing (bordering on "easy to break the world", e.g. https://chromereviews.googleplex.com/465757013).
I'm now trying to return additional data from
/handshake
, that can be used inget_dimensions
to make decisions. Unfortunately,get_dimensions
is called twice in different circumstances even before/handshake
is called. Adding third flavor of environment in whichget_dimensions
is called is too much.Proposal:
on_bot_startup
is called before any other hook (including beforeget_dimensions
).on_bot_startup
receives special uninitialized bot.Bot object.on_bot_startup
to return bot ID, initial set of dimensions and state, send them to the/handshake
./handshake
receives initial dimensions and state that may be changed in the future byget_dimensions
andget_state
.get_dimensions
andget_state
are called immediately before/poll
(e.g. after all initialization and initial handshake).get_dimensions
(bot changing its ID midlife doesn't make much sense).The new flow then would be:
on_bot_startup
is called (with bot.Bot.id == 'none'), it initializes Android subsystem and bot ID and initial dimensions and state./handshake
is called. It may return additional server-supplied data, fetched based on bot's ID.get_dimensions
andget_state
are called. They may use state set up inon_bot_startup
and data returned by/handshake
./poll
The text was updated successfully, but these errors were encountered: