def create_influxdb_writer(influxdb_client, series_name="gpu_measurements", **tags):
""" Returns function which writes to influxdb
Parameters
----------
influxdb_client:
series_name: (str)
tags: Extra tags to be added to the measurements
"""
to_influxdb = _influxdb_writer_for(influxdb_client, series_name)
if tags:
logger.debug('Creating writer with tags')
write_to_db = compose(to_influxdb,
_add_tags(tags),
_to_json_dict,
parse_line)
else:
logger.debug('Creating writer')
write_to_db = compose(to_influxdb,
_to_json_dict,
parse_line)
return _call_when(write_to_db, lambda x: x is not None and '#' not in x)
评论列表
文章目录