core/influx: reuse _locate_functions_or_prompt to choose the data provider
This commit is contained in:
parent
0517f7ffb8
commit
68019c80db
1 changed files with 6 additions and 10 deletions
|
@ -132,16 +132,12 @@ def main() -> None:
|
||||||
|
|
||||||
@main.command(name='populate', short_help='populate influxdb')
|
@main.command(name='populate', short_help='populate influxdb')
|
||||||
@click.option('--reset', is_flag=True, help='Reset Influx measurements before inserting', show_default=True)
|
@click.option('--reset', is_flag=True, help='Reset Influx measurements before inserting', show_default=True)
|
||||||
@click.argument('MODULE', type=str, required=True)
|
@click.argument('FUNCTION_NAME', type=str, required=True)
|
||||||
def populate(module: str, reset: bool) -> None:
|
def populate(function_name: str, reset: bool) -> None:
|
||||||
from .stats import guess_data_providers
|
from .__main__ import _locate_functions_or_prompt
|
||||||
providers = guess_data_providers(module)
|
[provider] = list(_locate_functions_or_prompt([function_name]))
|
||||||
# meh.. encapsulate in guess_data_providers?
|
# todo could have a non-interactive version which populates from all data sources for the provider?
|
||||||
if 'inputs' in providers:
|
magic_fill(provider, reset=reset)
|
||||||
del providers['inputs']
|
|
||||||
# todo could do interactive thing? same way as in hpi query
|
|
||||||
[(k, f)] = providers.items()
|
|
||||||
magic_fill(f, reset=reset)
|
|
||||||
|
|
||||||
|
|
||||||
# todo later just add to hpi main?
|
# todo later just add to hpi main?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue