-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement logging timestamps and record container ID in a file #649
implement logging timestamps and record container ID in a file #649
Conversation
Can one of the admins verify this patch? |
Jenkins, okay to test |
Not sure why failed Jenkins... Console Output didn't give much information.. |
Jenkins, test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! Just a few small changes
cwltool/main.py
Outdated
|
||
parser.add_argument("--cidfile-dir", type=Text, | ||
help="Directory for storing cidfiles. Default at /tmp/", | ||
default="/tmp/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current directory is a better default and is more portable.
cwltool/main.py
Outdated
@@ -84,6 +84,20 @@ def arg_parser(): # type: () -> argparse.ArgumentParser | |||
default=True, help="Do not delete Docker container used by jobs after they exit", | |||
dest="rm_container") | |||
|
|||
parser.add_argument("--record-container-id", action="store_true", default=False, | |||
help="If enabled, a file with suffix \".cid\" will be created storing the container ID under CIDFILE_DIR", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you linewrap at 80 for easier reviews?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"storing the container ID under the directory specified by --cidfile-dir"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new options would be best to put in their own https://docs.python.org/2.7/library/argparse.html#argument-groups. You can use that help to explain what a "cidfile" is.
cwltool/main.py
Outdated
@@ -161,6 +175,7 @@ def arg_parser(): # type: () -> argparse.ArgumentParser | |||
exgroup.add_argument("--verbose", action="store_true", help="Default logging") | |||
exgroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.") | |||
exgroup.add_argument("--debug", action="store_true", help="Print even more logging") | |||
parser.add_argument("--logtstp", action="store_true", help="Print timestamps with logging") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think --timestamps
would be a better name and "Add timestamps to the errors, warnings, and notifications."
cwltool/job.py
Outdated
if not os.path.isdir(cidfile_dir): | ||
_logger.error("--cidfile-dir %s error:\n%s", cidfile_dir, | ||
cidfile_dir + " is not a directory or directory doesn't exist, please check it first") | ||
exit(-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be exit(2)
: https://docs.python.org/2/library/sys.html#sys.exit
cwltool/job.py
Outdated
if not os.path.exists(cidfile_dir): | ||
_logger.error("--cidfile-dir %s error:\n%s", cidfile_dir, | ||
"directory doesn't exist, please create it first") | ||
exit(-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be exit(2)
: https://docs.python.org/2/library/sys.html#sys.exit
cwltool/job.py
Outdated
if cidfile_prefix != "": | ||
cidfile_name = str(cidfile_prefix + "-" + cidfile_name) | ||
cidfile_path = cidfile_dir + cidfile_name | ||
runtime.append(u"--cidfile=%s" % cidfile_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an equivalent for Singularity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but I don't think I understand this. Can you explain it a little bit.
I have finished other suggested changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this option only works for the Docker runtime then we should say so. If we can add the equivalent option for Singularity then that would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, it comes with docker. I didn't know singularity before, but by reading its documents, I believe it's possible to add the equivalent option.
Jenkins, test this please |
… into feature/time-logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Added options: