-
Notifications
You must be signed in to change notification settings - Fork 343
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
Unify commands and centralize logging #703
Conversation
33bcce6
to
91ea5c9
Compare
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.
Very nice!!!! 🚀
I think that we could do another iteration.
- Args mostly repeats --repo --token etc...
- I would put everything under CML.js exporting the parameters
What do you think?
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.
Also, winston should cover every log, we do not have to it here but would be awesome if we do not forget a technical debt ticket
Yes, #22 states that we should «change every |
Yes, I'm leaving that for another pull request, but we could move all the common arguments to the top level |
I would rather separate the command–line interface from |
Thats what I say, ideally we just only need one cli file if we expose the ARGS the CML.js module. |
Ooops! My bad, I thought you mean Yes, we could move all the commands to the latter instead of having separate files, but I still would prefer to keep separate files for each subcommand; it feels cleaner to me. Nevertheless, we could extract the common options to |
91ea5c9
to
8c1e5dc
Compare
8c1e5dc
to
26be40d
Compare
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.
would've been better to split into separate PRs but whatever
Dockerfile
Outdated
@@ -101,4 +101,4 @@ WORKDIR ${RUNNER_PATH} | |||
|
|||
# COMMAND | |||
ENV IN_DOCKER=1 | |||
CMD ["cml-runner"] | |||
CMD ["cml"] |
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.
perhaps something like this?
CMD ["cml"] | |
ENTRYPOINT ["/usr/bin/cml"] | |
CMD ["runner"] |
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.
Absolutely for using ENTRYPOINT
as the entry point. 💯 Absolutely not for using runner
as the default command; it doesn't make any sense (to my mind) and that behavior is not even documented.
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.
CMD ["cml"] | |
ENTRYPOINT ["/usr/bin/cml"] |
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.
sure but one thing to note is pple who were overriding CMD with e.g. /bin/bash
will now get an error. They'll have to switch to using --entrypoint /bin/bash
instead.
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.
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.
docker run iterativeai/cml cml publish # CMD
docker run iterativeai/cml publish # ENTRYPOINT
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 fiind this better:
docker run iterativeai/cml cml publish # CMD
than this:
docker exec myimage sh -c nvidia-smi
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.
Why not have the best of both worlds?
docker run iterativeai/cml publish
docker run iterativeai/cml nvidia-smi
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.
Applied with a536f07
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 that a536f07 is misleading. cml does not support those commands, how is the user going to guess that docker hack? He is not be able to do that with standalone CML.
I do not think is is a good change. What do you think @casperdcl ?
not worth the effort now :) |
26be40d
to
540d16e
Compare
540d16e
to
afa0f3d
Compare
afa0f3d
to
8b0c76a
Compare
Co-authored-by: Helio Machado <[email protected]>
3756e81
to
e27d337
Compare
@0x2b3bfa0 I'll leave you to open follow up issue(s)/epics |
I was doing exactly that 😄 |
To be honest, I do not consider the docker issue fixed to have merged this. |
…-termination * Port all the changes over #703
Changes
Fixes Better logging #22 by using
winston
as a logging library instead of manually monkey–patching and aliasingconsole.log
andconsole.error
to custom identifiers. Running commands on a TTY will print colorized, human readable logs; other scenarios (like piping) will produce machine-readable JSONL like in thegh
command-line tool. Now there is a single exception handler common for all the command-line interface, eliminating all the duplicate code and delegating the exception formatting on the logging library.Fixes Unify commands under a single entry point #699 by moving all the separate commands until a single command named
cml
and setting up aliases for backwards comaptibility.Partially fixes (this is not a closing keyword) Add documentation links and helpful descriptions to error messages #606, but needs additional work from the documentation side so we can link it from the error messages.
Introduces automatic environment variable processing with
yargs.env
socml --long-option=value
is equivalent toCML_LONG_OPTION=value cml
without any maintenance overhead.Introduces plugin support, allowing executables on the
PATH
to be called as subcommands from the newcml
command; e.g. callingcml something
will try to find and executecml-something
if it's in your path. As ingh
extensions, external commands can't override internal ones under any circumstance.Removes the default
CMD
on our container images (was set tocml-runner
for no apparent reason) and sets a smartENTRYPOINT
that interprets unknown commands ascml
commands. It didn't make too much sense to favor a tool over the rest and have seven similar ways of checking the installed CML version.Fixes an appearance of Tests hang forever #694 caused by an infinite loop on
pipe-args.js
that doesn't break when there is no piped data;fs.readSync
throwsEAGAIN
but it was being silently ignored.Follow-ups
pino
instead ofwinston
for logging #709Note: this time I am erring on the opposite side and packing many loosely related changes together, because shipping them separately would involve lots of intermediate commits with useless, hand-tailored workarounds to keep everything working until the next one.