scheduler.cli.task: Make `task archive` actually archive scheduler's tasks
This fixes many issues with the current archive cli which prevented it from working:
-
cli.task: Use the configuration provided by the cli
-> it was no longer using the config provided, so failing to initialize the elasticsearch client.
-
cli.task: Tasks needs to be sorted prior to group by call
-> otherwise the initial group by's point is moot
-
backend_es: Open indices prior to indexing method calls (and close it back when done)
-> in production, most old indices are closed. So we need to open them, do our bidding, then close.
-
backend_es: Create index when it does not exist
-> new indices need to be created since the last time the cli ran...
Depends on !125 (closed) Related to #1931 (closed)
Test Plan
- prod: I tried the following diff and !125 (closed) in prod and it's green
- Add tests using an in-memory elasticsearch client (oriented towards storage, not search)
Migrated from D2458 (view on Phabricator)