Commit 1676fe87 authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

separated export job info and generate json routines

parent e50ca427
......@@ -29,7 +29,7 @@ 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 {text,pdf}] JOBID
usage: data.py [-h] [-t {text,pdf}] JOBID
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.
......@@ -39,7 +39,6 @@ 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 {text,pdf}, --type {text,pdf}
type of the output (default: text)
......@@ -69,4 +68,8 @@ As an example the following command will output the test data in the `json` form
```
## Export job info
If the `data.py` is called with `-s`(`--save`) flag as `data.py -s JOBID`, then the aggregator will gather a job information with ID `JOBID` from the batch system configured in `/conf/config.py` and save it into the configured database as a `pfit-jobinfo` measurement.
In order to export the job info with `JOBID` you should call `export.py`:
```bash
export.py JOBID
```
Then the aggregator will gather a job information with ID `JOBID` from the batch system configured in `/conf/config.py` and save it into the configured database as a `pfit-jobinfo` and additionally in `pfit-jobinfo-alloc` measurements.
......@@ -3,7 +3,6 @@
import json
import argparse
import db.aggregator as aggregator
import postexec.exportjobinfo as xjob
import conf.config as conf
from format import format
......@@ -18,12 +17,8 @@ def main():
parser = argparse.ArgumentParser(description="""
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)
parser.add_argument("-s", "--save", help="save batch info of the job in DB",
action="store_true")
parser.add_argument("-t", "--type", help="type of the output",
choices=['text', 'pdf'], default="text")
......@@ -33,14 +28,6 @@ def main():
args = parser.parse_args()
job_id = args.JOBID
if args.save:
res = xjob.export_job_info(job_id)
if res is not True:
return res
print("Job {} was exported".format(job_id))
return 0
print_job_info(job_id, args.type)
return 0
......
#! /usr/bin/env python3
import json
import argparse
import postexec.exportjobinfo as xjob
import conf.config as conf
def main():
parser = argparse.ArgumentParser(description="""
Gets the job information from the Batch system and
stores the job info in DB.
""", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("JOBID",
help="job ID used in the batch system")
args = parser.parse_args()
job_id = args.JOBID
res = xjob.export_job_info(job_id)
if res is not True:
return res
print("Job {} was exported".format(job_id))
return 0
if __name__ == "__main__":
main()
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