def preprocess_nodes_stdin() -> None: # load the json from stdin node_dicts = json.load(sys.stdin) # parse the job dictionaries into hpc Job objects nodes = [SchedulerNode.from_dict(n) for n in node_dicts] # run our preprocessing modified_nodes = preprocess_nodes(nodes) # finally dump the modified jobs out to stdout json.dump(modified_nodes, sys.stdout, default=lambda x: x.to_dict())
def test_schedulernode_json(a: SchedulerNode): b = SchedulerNode.from_dict(a.to_dict()) assert _cmp(a, b)