Repository navigation
Description
I'm working on a situation where a process has no dbprocessing inputs but we want the code and outputs to be managed by dbprocessing. Because DBRunner already supports running a process more or less by-hand. this can be used to run processes (and make products) without requiring a specific input. The use case here is for codes that have the information they need to produce data, e.g. from a model, or propagating an orbit ephemeris, or handling a complicated non-file input that doesn't fit well within the dbprocessing framework
Proposed enhancement
There are basically two pieces: first, ensure that everything works with processes that have no input. Second, add functionality to DBRunner to have some of the features of ProcessQueue. This is going to involve breaking out some of that functionality into a common spot. It's already an issue, because the main loop in DBRunner that finds input files and builds runMe objects already somewhat duplicates ProcessQueue functionality, so it'll help to have this in a common spot. DBRunner will need to support (optionally for all) executing processes without inputs, ingesting the output of the execution to the database, running only processes which are out-of-date (i.e. input files or code are newer than output) vs. force-execution.
Alternatives
Use trigger files: My first thought was to define a dummy "product" that is the input to the process, and this "product" would just be a text file containing the range of dates to process. This would require no dbp changes, but another set of inspectors and the hand-writing of fake "data files". This also gets into issues of versioning: Consider one trigger file that runs 2019-01-01 through 2019-12-31. Then the file date is 2019-01-01 (arbitrary choice, but one date must be chosen) and it'll run that year. Then we update with a trigger for 2019-06-01 through 2020-05-31. Files before 2020-01-01 are updated; files after are new. The first trigger file is the input for the newest version of some files but not others.
Ingest the output of the code directly into dbprocessing: This requires giving up dbprocessing knowledge of the code (versoins, etc.) and also doing all of the code execution by hand, unassisted by dbprocessing. The dbprocessing process-execution functionality (e.g. parallelizing, figuring out command line arguments, output versions) is pretty useful in its own right.
Status
I'll open a draft PR eventually but right now I'm in a stage that might require substantial rebasing.
- Allow ingest of DBRunner output.
- Allow execution of DBRunner with no input files.
- Allow execution unconditionally (as now), only for out-of-date files (i.e. the code has been updated), or bump version (similar to the force argument for reprocess). Any option to run with same/unspecified version should not allow ingest, so need some arg checking.
- Test that addFromConfig works for processes with no input product
- Test that a process can be put in database with no input
- Test that runMe will build a command line with no input files
- Test getTraceback on a file resulting from a process with no input product
Closure condition
This issue can be closed when the new functionality is merged.
Activity
jtniehof commentedon Sep 3, 2020
Unfolding the handling of versions here. Most of the version handling (and checking for existing files) is in the runMe constructor; there's a (nominally) infinite loop around line 356, labeled "in this loop see if the file can be created." Once the version has been determined (either through no conflicting version in the db or forced execution), the loop breaks.
Things we want to support:
force=True,version_bumpisNone). Not compatible with ingest.-u/--updatefor the command line flag. (runMe argsforce=False(default),version_bumpisNone). Compatible with ingest.--forceand might as well use the same argument for it. (runMe argsforce=False(default),version_bump0-2. Note the possible confusion between theforcekwarg and theforcecommand line arg, but that ship has sort of sailed already...). Compatible with ingest.The good thing is that all DBRunner has to do is get the arguments to runMe right; runMe does most of the work, and there are a number of tests in test_runMe. So DBRunner will pick up a few more tests but they'll be more like functional tests in the end.