Skip to content

Convert Lemur from a "CLI-only" application to a "library with CLI wrapper" #23

@mlimotte

Description

@mlimotte

Requested by Kyle Burton, Ryan Michael and Andrew Montalenti.

There have been some requests to allow lemur to be used as a library instead of a CLI just tool.

Roughly, this is the work effort:

  1. CLI wrapper.
    Solution: Move the -main fn from lemur.core into a new namespace (e.g. lemur.tool) and change the shell script bin/lemur to use the new namespace.
  2. The lemur.command-line/quit function does an actual System/exit.
    Solution: Make it throw an Exception instead; and have the lemur.tool wrapper catch the Exception and do System/exit with the error message.
  3. And the key problem: lemur.core manages a bunch of state in a global atom (not a great practice, but I didn't know any better Clojure patterns at the time). It's not really a problem for command line, but if you start to use it as a lib, there will be conflicts when multiple jobs are submitted.
    Solution: Create a context object and change functions that use the global context to accept an extra arg instead. This should only impact the lemur.core namespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions