-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test checking that the input and output directories are prope…
…rly configured when running archive containers. This is part of #751.
- Loading branch information
Richard Liang
committed
Mar 1, 2019
1 parent
39e2360
commit 42b66e6
Showing
2 changed files
with
158 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! /usr/bin/env python | ||
|
||
import os | ||
import json | ||
from argparse import ArgumentParser, FileType | ||
|
||
|
||
def parse_args(): | ||
parser = ArgumentParser( | ||
description="Counts the number of lines in the input file, reports the contents of /mnt/input and /mnt/output." | ||
) | ||
parser.add_argument( | ||
'input_text', | ||
type=FileType("rt"), | ||
help='A text file, anything goes' | ||
) | ||
parser.add_argument('summary_json', type=FileType('w')) | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
summary = { | ||
"lines": sum(1 for _ in args.input_text), | ||
"mnt_input_contents": os.listdir("/mnt/input"), | ||
"mnt_output_contents": os.listdir("/mnt/output") | ||
} | ||
args.summary_json.write(json.dumps(summary)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |