rattail.commands.batch

Batch-related commands

Helper Functions

rattail.commands.batch.batch_action_command(fn)[source]

Decorator for batch handler commands. Adds common params based on batch_action_command_template().

rattail.commands.batch.batch_action_command_template(batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b17e80>] = Ellipsis, batch_uuid: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b17f70>] = Ellipsis, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f070>] = False)[source]

Stub function which provides a common param signature; used with batch_action_command().

Subcommands

rattail.commands.batch.auto_receive(ctx: ~typer.models.Context, batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b17e80>] = Ellipsis, batch_uuid: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b17f70>] = Ellipsis, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f070>] = False)[source]

Auto-receive all items in a receiving batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'auto-receive', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail auto-receive [OPTIONS] BATCH_UUID                               
                                                                                
 Auto-receive all items in a receiving batch                                    
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      TEXT  UUID of the batch to be processed.                │
│                            [default: None]                                   │
│                            [required]                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        TEXT  Type of batch to be dealt with, e.g.            │
│                              'vendor_catalog'                                │
│                              [default: None]                                 │
│                              [required]                                      │
│    --dry-run                 Go through the full motions and allow logging   │
│                              etc. to occur, but rollback (abort) the         │
│                              transaction at the end.                         │
│    --help                    Show this message and exit.                     │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.execute_batch(ctx: ~typer.models.Context, batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b17e80>] = Ellipsis, batch_uuid: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b17f70>] = Ellipsis, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f070>] = False, execute_kwargs: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b1f9d0>] | None = None)[source]

Execute a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'execute-batch', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail execute-batch [OPTIONS] BATCH_UUID                              
                                                                                
 Execute a batch                                                                
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      TEXT  UUID of the batch to be processed.                │
│                            [default: None]                                   │
│                            [required]                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        TEXT   Type of batch to be dealt with, e.g.           │
│                               'vendor_catalog'                               │
│                               [default: None]                                │
│                               [required]                                     │
│    --dry-run                  Go through the full motions and allow logging  │
│                               etc. to occur, but rollback (abort) the        │
│                               transaction at the end.                        │
│    --kwargs            LOADS  Optional JSON-encoded string containing extra  │
│                               keyword arguments to be passed to the          │
│                               handler's batch execution function.            │
│                               [default: None]                                │
│    --help                     Show this message and exit.                    │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.make_batch(ctx: ~typer.models.Context, batch_type: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b1f3a0>] = Ellipsis, input_file: ~typing.Annotated[~pathlib.Path, <typer.models.OptionInfo object at 0x7f5a19b1f460>] = Ellipsis, create_kwargs: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b1f520>] | None = None, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f5e0>] = False)[source]

Make a new batch, from a data file

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'make-batch', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail make-batch [OPTIONS] BATCH_TYPE                                 
                                                                                
 Make a new batch, from a data file                                             
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_type      TEXT  Type of batch to be created, e.g.                 │
│                            'vendor_catalog'                                  │
│                            [default: None]                                   │
│                            [required]                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --input-file        PATH   Path to single input file, to be used as data  │
│                               source for the new batch.  (File format will   │
│                               vary depending on batch type.)                 │
│                               [default: None]                                │
│                               [required]                                     │
│    --kwargs            LOADS  Optional JSON-encoded string containing extra  │
│                               keyword arguments to be passed to the          │
│                               handler's batch creation logic.                │
│                               [default: None]                                │
│    --dry-run                  Go through the full motions and allow logging  │
│                               etc. to occur, but rollback (abort) the        │
│                               transaction at the end.                        │
│    --help                     Show this message and exit.                    │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.populate_batch(ctx: ~typer.models.Context, batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b17e80>] = Ellipsis, batch_uuid: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b17f70>] = Ellipsis, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f070>] = False)[source]

Populate initial data for a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'populate-batch', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail populate-batch [OPTIONS] BATCH_UUID                             
                                                                                
 Populate initial data for a batch                                              
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      TEXT  UUID of the batch to be processed.                │
│                            [default: None]                                   │
│                            [required]                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        TEXT  Type of batch to be dealt with, e.g.            │
│                              'vendor_catalog'                                │
│                              [default: None]                                 │
│                              [required]                                      │
│    --dry-run                 Go through the full motions and allow logging   │
│                              etc. to occur, but rollback (abort) the         │
│                              transaction at the end.                         │
│    --help                    Show this message and exit.                     │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.purge_batches(ctx: ~typer.models.Context, list_types: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1faf0>] = False, batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b1fb80>] = Ellipsis, before: ~typing.Annotated[~datetime.datetime, <typer.models.OptionInfo object at 0x7f5a19b1fee0>] | None = None, before_days: ~typing.Annotated[int, <typer.models.OptionInfo object at 0x7f5a19b25070>] = 90, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b25490>] = False)[source]

Purge old batches from the database

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'purge-batches', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail purge-batches [OPTIONS]                                         
                                                                                
 Purge old batches from the database                                            
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│    --list-types                     If set, list available batch types       │
│                                     instead of trying to purge anything.     │
│ *  --batch-type         TEXT        Type of batch to be purged, e.g.         │
│                                     'vendor_catalog'                         │
│                                     [default: None]                          │
│                                     [required]                               │
│    --before             [%Y-%m-%d]  Purge all batches executed prior to this │
│                                     date.  If not specified, will use        │
│                                     --before-days to calculate instead.      │
│                                     [default: None]                          │
│    --before-days        INTEGER     Number of days before the current date,  │
│                                     to be used as the cutoff date if         │
│                                     --before is not specified.  Default is   │
│                                     90 days before current date.             │
│                                     [default: 90]                            │
│    --dry-run                        Go through the full motions and allow    │
│                                     logging etc. to occur, but rollback      │
│                                     (abort) the transaction at the end.      │
│    --help                           Show this message and exit.              │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.refresh_batch(ctx: ~typer.models.Context, batch_type: ~typing.Annotated[str, <typer.models.OptionInfo object at 0x7f5a19b17e80>] = Ellipsis, batch_uuid: ~typing.Annotated[str, <typer.models.ArgumentInfo object at 0x7f5a19b17f70>] = Ellipsis, dry_run: ~typing.Annotated[bool, <typer.models.OptionInfo object at 0x7f5a19b1f070>] = False)[source]

Refresh data for a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/srv/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'refresh-batch', '--help']
DEBUG [wuttjamaican.conf][MainThread] config files read: ['/etc/rattail/rattail.conf']
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.db
DEBUG [wuttjamaican.conf][MainThread] applying config extension: rattail.trainwreck
                                                                                
 Usage: rattail refresh-batch [OPTIONS] BATCH_UUID                              
                                                                                
 Refresh data for a batch                                                       
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      TEXT  UUID of the batch to be processed.                │
│                            [default: None]                                   │
│                            [required]                                        │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        TEXT  Type of batch to be dealt with, e.g.            │
│                              'vendor_catalog'                                │
│                              [default: None]                                 │
│                              [required]                                      │
│    --dry-run                 Go through the full motions and allow logging   │
│                              etc. to occur, but rollback (abort) the         │
│                              transaction at the end.                         │
│    --help                    Show this message and exit.                     │
╰──────────────────────────────────────────────────────────────────────────────╯