adamkewley / jobson

A platform for transforming command-line applications into a job service.
Apache License 2.0
256 stars 20 forks source link

jobson serve without arguments should load config.yml #102

Closed DannyBen closed 1 year ago

DannyBen commented 1 year ago

EDIT: I found the problem, leaving the original issue below in case it is of interest.

Running jobson serve without a file is possible, and it does not load the default config.yml. Only running jobson serve config.yml works.

I believe this is a bug. Either disallow running without a filename, or default to the file created by jobson new (config.yml).


First of all, this is a magnificent project with a perfect name.

I have followed the standard installation (.deb) procedures, created a workspace, a user and a spec. After that, running jobson serve shows this error below.

There is no usersConfiguration anywhere in any of the generated files, so not sure where else to look for the problem's root cause.

Also as a side topic: I would suggest disabling the output of the java backtrace (perhaps unless an environment variable is set) - this information is of no use to the end users, and only makes it seem like an "unhandled error".

I am not providing the config.yml, since it is the default one generated by the new command.

Note: I just noticed this is also happening when using jobson new --demo - same error.

I am on Ubuntu 20.04.5 LTS if that matters.

$ jobson serve
io.dropwizard.configuration.ConfigurationParsingException: default configuration has an error:
  * Unrecognized field at: usersConfiguration
    Did you mean?:
      - authentication
      - execution
      - users
      - workingDirs
      - server
        [5 more]

    at io.dropwizard.configuration.ConfigurationParsingException$Builder.build(ConfigurationParsingException.java:278)
    at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:139)
    at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:108)
    at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:128)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:74)
    at io.dropwizard.cli.Cli.run(Cli.java:78)
    at io.dropwizard.Application.run(Application.java:94)
    at com.github.jobson.App.main(App.java:74)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "usersConfiguration" (class com.github.jobson.config.ApplicationConfig), not marked as ignorable (10 known properties: "metrics", "jobs", "workingDirs", "specs", "logging", "server", "users", "admin", "authentication", "execution"])
 at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.github.jobson.config.ApplicationConfig["usersConfiguration"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:843)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1206)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1610)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1588)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
    at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4189)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2476)
    at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:126)
    ... 6 more
adamkewley commented 1 year ago

I am glad you worked around this!

I always found it quite annoying also, but the CLI is (kind of) provided via dropwizard which (iirc) kind of requires the configuration argument (unless I start screwing with the CLI command with various hacks, like adding a shadow argument, at least)