Skip to content

Appropriate default for JOB_CONFIGURATION_FILE #1438

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

Closed
sbliven opened this issue Oct 14, 2024 · 1 comment
Closed

Appropriate default for JOB_CONFIGURATION_FILE #1438

sbliven opened this issue Oct 14, 2024 · 1 comment
Labels
enhancement New feature or request Release Jobs Jobs migration
Milestone

Comments

@sbliven
Copy link
Member

sbliven commented Oct 14, 2024

Appropriate default for JOB_CONFIGURATION_FILE

Summary

SciCat should have an appropriate default job configuration.

Current Behaviour

The job configuration file is read from the JOB_CONFIGURATION_FILE. It currently defaults to (src/config/configuration.ts:47):

  const jobConfigurationFile =
    process.env.JOB_CONFIGURATION_FILE ||
    ("src/jobs/config/jobConfig.example.json" as string);

This was convenient for development, but should now be set to a secure final value.

Expected Behaviour

I would say that the default behavior when JOB_CONFIGURATION_FILE is unset should be to look for "jobConfig.json" in the current directory. This mirrors the location for functionalAccounts.json. If the file is not found it should be treated as an empty config, eg

{
  "configVersion": "",
  "jobs": []
}

If #1120 is implemented then Scicat checks for ./jobConfig.{json,yaml,yml} and uses the first one found.

If JOB_CONFIGURATION_FILE is set then it is loaded. An error should be thrown if the file is not found.

@sbliven sbliven added enhancement New feature or request Release Jobs Jobs migration labels Oct 14, 2024
@sbliven sbliven added this to the Release Jobs milestone Oct 14, 2024
@sbliven sbliven moved this to Todo in Core Release Jobs Oct 14, 2024
@despadam despadam moved this from Todo to Accepted in Core Release Jobs Dec 18, 2024
@sbliven sbliven moved this from Accepted to Done in Core Release Jobs Feb 4, 2025
@sbliven
Copy link
Member Author

sbliven commented Feb 4, 2025

This was resolved by #1539, but with slightly different behavior. If JOB_CONFIGURATION_FILE is omitted then it doesn't configure any jobs. Thus any request to POST /jobs will lead to an unknown job type error.

If you want to configure the job system, it is required to set JOB_CONFIGURATION_FILE=jobConfig.yaml manually. The file extension is ignored, with either JSON or YAML content supported.

@sbliven sbliven closed this as completed Feb 4, 2025
@github-project-automation github-project-automation bot moved this from Done to Ready in Core Release Jobs Feb 4, 2025
@sbliven sbliven moved this from Ready to Done in Core Release Jobs Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Release Jobs Jobs migration
Projects
Status: Done
Development

No branches or pull requests

1 participant