Page MenuHomePhabricator

[jobs-api] move jobs load feature to the backend
Closed, ResolvedPublic

Description

Why?
some cli arguments default values are generated on the backend and there are currently no non-brittle way to infer what these values are.
example: filelog-stdout default value of /data/project/<tool-name>/<jobname>.out is generated on the backend.

If you want to know what these default values are, there are three possible ways to go about it:

  1. try to infer on the frontend what this value might possibly be. This will mean storing the default prefix /data/project somewhere on the frontend, that you can later combine with the tool and job names to get the potential default value. The problem with this is that there now exist two sources of truth for this. What happens when for some reason we tweak this default value on the backend and then forget to update the frontend? yeaa, regression.
  2. create api endpoint that returns the default values of a job from the backend.
  3. preferred option is to move everything about the load feature to the backend.

Advantages:

  • simplified frontend code. we won't have to run relatively complex algorithms on the frontend just to figure out something as simple as the default values of a job. all of that will be done on the backend.
  • more accurate load operation. for example:
    • we will be able to handle filelog-stderr and filelog-stdout (we don't currently handle these in the loads operation which means that not explicitly providing filelog-stdout/stderr in loads yaml for a job that returns these values from the backend will cause the job to be deleted and recreated)
    • better handling of cpu and memory changes (right now explicitly setting default cpu/memory in loads yaml counts as a difference but it shouldn't)

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
d/changelog: bump to 16.1.0repos/cloud/toolforge/jobs-cli!58raymond-ndibebump_versionmain
jobs-api: bump to 0.0.325-20240729181356-e2f35e86repos/cloud/toolforge/toolforge-deploy!459ghostbump_jobs-apimain
jobs-api: bump to 0.0.324-20240729172834-18574769repos/cloud/toolforge/toolforge-deploy!458ghostbump_jobs-apimain
[toolforge-weld]: add patch method to ToolforgeClientrepos/cloud/toolforge/toolforge-weld!49raymond-ndibetoolforge_client_add_patch_methodmain
[jobs-api] refactor before moving jobs load to backendrepos/cloud/toolforge/jobs-api!103raymond-ndibemore_refactormain
[jobs-cli] refactor job validationrepos/cloud/toolforge/jobs-cli!45raymond-ndiberefactor_job_validationmain
[jobs-cli] move jobs load to backendrepos/cloud/toolforge/jobs-cli!44raymond-ndibemove_jobs_load_to_backendmain
jobs-api: bump to 0.0.309-20240619035632-dcbef566repos/cloud/toolforge/toolforge-deploy!338ghostbump_jobs-apimain
[jobs-api] move jobs load to backendrepos/cloud/toolforge/jobs-api!93raymond-ndibemove_jobs_load_to_backendmain
[jobs-api] move simple job validations to pydanticrepos/cloud/toolforge/jobs-api!89raymond-ndibemove_simple_job_validations_to_pydanticmain
Customize query in GitLab

Event Timeline

This would go away if we move that logic to the API right?

Once this is in T362075: [components-api] add order to the components deployment the jobs.yaml can become 'toolforge deploy' and the validation will be done on the API side, so focusing on getting that rolling might be a better option than implementing all this now to scratch it later (specially given that removing things is way harder than adding ones).

We also have the openapi definition, that once we generate the clients from it will probably include defaults and such on them.

Note though that the parameters in the cli and in the API might be different already (iirc some have different name, and different shapes, ex. health-check-script).

then we rename this task to move jobs load logic to the jobs-api? that way it will still be valid for component-api? because we need to resolve this or else we can't say we've conclusively resolved the parent task https://phabricator.wikimedia.org/T364204

also I am working on unifying the parameters

Raymond_Ndibe renamed this task from [jobs-api] api endpoint that returns all the default values of a job from the backend to [jobs-api] move jobs load feature to the backend.Jun 3 2024, 2:25 PM
Raymond_Ndibe updated the task description. (Show Details)
Raymond_Ndibe updated the task description. (Show Details)
Slst2020 changed the task status from Open to In Progress.Jun 12 2024, 9:27 AM
Slst2020 moved this task from Next Up to In Progress on the Toolforge (Toolforge iteration 11) board.

project_1317_bot_df3177307bed93c3f34e421e26c86e38 opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/338

jobs-api: bump to 0.0.309-20240619035632-dcbef566

dcaro triaged this task as Medium priority.Jul 24 2024, 3:03 PM

project_1317_bot_df3177307bed93c3f34e421e26c86e38 opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/458

jobs-api: bump to 0.0.324-20240729172834-18574769

project_1317_bot_df3177307bed93c3f34e421e26c86e38 opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/459

jobs-api: bump to 0.0.325-20240729181356-e2f35e86