Skip to content

Support products with no input #9

Closed

Description

@jtniehof

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

  1. added
    enhancement
    on Jul 20, 2020
  2. self-assigned this
    on Jul 20, 2020
  3. jtniehof commented on Sep 3, 2020

    @jtniehof
    MemberAuthor

    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:

    • Always runs the process. Version is INTERFACE.0.0 (INTERFACE taken from the code output interface number.) No check for existing files or version conflicts. This is the current way it runs (runMe args force=True, version_bump is None). Not compatible with ingest.
    • Run the process only if the file does not exist or the code has been updated since. Version starts at INTERFACE.0.0 and is incremented according to the normal rules based on the version of the code that's updated. This is equivalent to a reprocessByX without force. I suggest -u/--update for the command line flag. (runMe args force=False (default), version_bump is None). Compatible with ingest.
    • Always run the process; if file exists, increment the version based on the argument. This is equivalent to a reprocessByX with --force and might as well use the same argument for it. (runMe args force=False (default), version_bump 0-2. Note the possible confusion between the force kwarg and the force command 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions