Commit 2a372d08 authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

ascii -> text

parent f7815360
......@@ -23,9 +23,9 @@ Sample configs must not be used in the code.
The main executable of the aggregator module is `data.py`. You can type `./data.py -h` for more help.
```
usage: data.py [-h] [-s] [-t {ascii,pdf}] JOBID
usage: data.py [-h] [-s] [-t {text,pdf}] JOBID
Gets the job information required for generating ASCII or PDF reports and
Gets the job information required for generating text or PDF reports and
outputs it in JSON format. Optionaly it stores the job info in DB.
positional arguments:
......@@ -34,9 +34,9 @@ positional arguments:
optional arguments:
-h, --help show this help message and exit
-s, --save save batch info of the job in DB (default: False)
-t {ascii,pdf}, --type {ascii,pdf}
-t {text,pdf}, --type {text,pdf}
type of the output (default: ascii)
type of the output (default: text)
```
## Get test output
......
......@@ -16,7 +16,7 @@ def print_job_info(job_id, type):
def main():
parser = argparse.ArgumentParser(description="""
Gets the job information required for generating ASCII or PDF reports
Gets the job information required for generating text or PDF reports
and outputs it in JSON format.
Optionaly it stores the job info in DB.
""", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
......@@ -25,7 +25,7 @@ def main():
action="store_true")
parser.add_argument("-t", "--type", help="type of the output",
choices=['ascii', 'pdf'], default="ascii")
choices=['text', 'pdf'], default="text")
parser.add_argument("JOBID",
help="job ID used in the batch system")
......
from .influx import influxdb_wrapper
def get_aggregator(job_id, type = "ascii"):
def get_aggregator(job_id, type = "text"):
aggr = influxdb_wrapper.get_aggregator(job_id, type)
return aggr
......@@ -20,7 +20,7 @@ def fetch_all(job_id, type):
return data
def get_aggregator(job_id, type="ascii"):
def get_aggregator(job_id, type="text"):
data = fetch_all(job_id, type)
aggr = Aggregator()
......
......@@ -70,8 +70,8 @@ def format_scheme(agg, sstruc, path="", **ids):
return result
def format_ascii(agg):
scheme = OutputSchemes.ascii
def format_text(agg):
scheme = OutputSchemes.text
result = {}
result = format_scheme(agg, scheme)
......@@ -90,14 +90,14 @@ def format_pdf(agg):
return result
def format(agg, type="ascii"):
def format(agg, type="text"):
if not isinstance(agg, Aggregator):
raise RuntimeError("No aggregator in the format method")
assert type in ["ascii", "pdf"]
assert type in ["text", "pdf"]
if type == "ascii":
formatted = format_ascii(agg)
if type == "text":
formatted = format_text(agg)
elif type == "pdf":
formatted = format_pdf(agg)
......
class OutputSchemes:
ascii = {
text = {
"type": "dict",
"path": "",
"scheme": {
......
......@@ -33,4 +33,4 @@ for i, _ in enumerate(agg.nodes):
setattr(agg.nodes[i], f, "node_" + str(i) + "_" + str(f) + "_value")
# format and output JSON
pprint(format.format_ascii(agg))
pprint(format.format_text(agg))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment