Invokes run function using a JSON file config. Args: args: CLI args, which can be a JSON file containing an object whose attributes are the parameters to the run function. If multiple JSON files are passed, their contents are concatenated. Returns: 0 if succe
(args)
| 62 | |
| 63 | |
| 64 | def main(args): |
| 65 | """Invokes run function using a JSON file config. |
| 66 | |
| 67 | Args: |
| 68 | args: CLI args, which can be a JSON file containing an object whose |
| 69 | attributes are the parameters to the run function. If multiple JSON |
| 70 | files are passed, their contents are concatenated. |
| 71 | Returns: |
| 72 | 0 if succeeded or nonzero if failed. |
| 73 | Raises: |
| 74 | Exception: If input data is missing. |
| 75 | """ |
| 76 | if not args: |
| 77 | raise Exception("Please specify at least one JSON config path") |
| 78 | inputs = [] |
| 79 | program = [] |
| 80 | outputs = [] |
| 81 | for arg in args: |
| 82 | with open(arg) as fd: |
| 83 | config = json.load(fd) |
| 84 | inputs.extend(config.get("inputs", [])) |
| 85 | program.extend(config.get("program", [])) |
| 86 | outputs.extend(config.get("outputs", [])) |
| 87 | if not program: |
| 88 | raise Exception("Please specify a program") |
| 89 | return run(inputs, program, outputs) |
| 90 | |
| 91 | |
| 92 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…