Skip to content
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

Merged

Conversation

MichaelTong
Copy link
Contributor

Added options:

--record-container-id
                      If enabled, a file with suffix ".cid" will be created
                      storing the container ID under CIDFILE_DIR
--cidfile-dir CIDFILE_DIR
                      Directory for storing cidfiles. Default at /tmp/
--cidfile-prefix CIDFILE_PREFIX
                      Give a prefix to cidfile. Final file name will be
                      followed by a timestamp. Default empty.
--logtstp             Print timestamps with logging

@cwl-bot
Copy link

cwl-bot commented Feb 8, 2018

Can one of the admins verify this patch?

@mr-c
Copy link
Member

mr-c commented Feb 8, 2018

Jenkins, okay to test

@MichaelTong
Copy link
Contributor Author

Not sure why failed Jenkins... Console Output didn't give much information..

@mr-c
Copy link
Member

mr-c commented Feb 9, 2018

Jenkins, test this please

Copy link
Member

@mr-c mr-c left a 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/",
Copy link
Member

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",
Copy link
Member

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?

Copy link
Member

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"

Copy link
Member

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")
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://singularity.lbl.gov/

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.

Copy link
Contributor Author

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.

@mr-c
Copy link
Member

mr-c commented Feb 9, 2018

Jenkins, test this please

Copy link
Member

@mr-c mr-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mr-c mr-c merged commit d16446d into common-workflow-language:master Feb 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants