Support submitting jobs with the file structure seen in examples #1108
Replies: 3 comments 4 replies
-
Can you simply set symbolic link of customer code directory to each job’s customer folder this way, you need one time setup and the code will reflect the latest changes. No need to anything else |
Beta Was this translation helpful? Give feedback.
-
Pre installation of the custom code to clients and set python path is also an option. Some clients prefer to use that way in production as this reduce the potential risk of unknown code uploaded to their site |
Beta Was this translation helpful? Give feedback.
-
@parkeraddison thanks for the discussion. You raise some good points/observations here. Just a note here, we are also thinking if there is a better way to organize "examples" such that it is easier for people to deploy/run right away? We are thinking of a more structural directory than what we already had here.
If we make these example folder structure more formalize and rigorous, then it is very natural for NVFlare to help run setup.sh and setup the link to these codes at deploy time. You can also provide your opinions on what should be the structure and required files. |
Beta Was this translation helpful? Give feedback.
-
Hi NVFlare team!
Recently we refactored our own codebase to be a lot more modular and maintainable when working with multiple different jobs and jobs with multiple apps (e.g. some jobs use different workflows, some apps use different data, networks, or other FL components). The way we accomplished this was by using a file structure similar to that in your examples/:
This way, the config of the various jobs can point to shared modules making it easy to maintain a single file rather than duplicating all custom/ files for a new job. In the event a job needs a different module, we write it as part of our src so that we can rely on perhaps shared utilities or re-use the workflow in a future job. If we improve a module such as the algorithm used in our learner, all jobs can benefit from this enhancement. And we stay DRY ;)
Issue
This structure is fun and works in the examples, but it doesn't work when submitting a job in a real deployment. If you copy config/ and custom/ to the admin's transfer/ directory then submit e.g.
submit_job config/simple-job
, only simple-job/simple-app/config/ gets transferred to the participants, so no custom modules are able to be loaded.The reason this structure works in the examples is because (I think) all of the processes are launched from a terminal with the src/ directory above accessible from the pwd, rather than relying on the admin transferring that custom code.
Workaround
The workaround we're currently using is to additionally copy custom/ into admin/transfer/simple-job/simple-app/ before submitting -- but this is a bit tedious for something like complex-job in the example above where we'd need to copy custom/ into all of the three apps (A-, B-, and server-) before submitting. Plus it leaves some more room for human error, stale files, etc.
cp -r config/ admin/transfer/ cp -r custom/ admin/transfer/config/simple-job/simple-app/ > submit_job config/simple-job
Solution
Is there a solution to allow a maintainable file structure like the above example to be used in real deployment? I.e. by copying both config/ and custom/ to the admin's transfer/ directory then having all necessary custom modules sent to the participants when submitting a job?
Some ideas I had were perhaps:
deploy_map
, we could specify different filepaths (relative to admin/transfer/) to be sent to specific clientsGotta admit that developing with this modular file structure is honestly a joy and lets us harness the full power of your config parsing, components, nested components, etc -- so I'm hoping this will be supported moving forward :D Lmk what you think and if I can help at all!
Beta Was this translation helpful? Give feedback.
All reactions