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: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4110>]=Ellipsis, batch_uuid: Annotated[str, <typer.models.ArgumentInfo object at 0x7f1a696e4210>]=Ellipsis, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e43d0>]=False)[source]

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

Subcommands

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

Auto-receive all items in a receiving batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'auto-receive', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 Usage: rattail auto-receive [OPTIONS] {batch_uuid}                             
                                                                                
 Auto-receive all items in a receiving batch                                    
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      <str>  UUID of the batch to be processed. [required]    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        <str>  Type of batch to be dealt with, e.g.           │
│                               'vendor_catalog'                               │
│                               [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: Context, batch_type: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4110>]=Ellipsis, batch_uuid: Annotated[str, <typer.models.ArgumentInfo object at 0x7f1a696e4210>]=Ellipsis, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e43d0>]=False, execute_kwargs: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4b90>]=None)[source]

Execute a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'execute-batch', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 Usage: rattail execute-batch [OPTIONS] {batch_uuid}                            
                                                                                
 Execute a batch                                                                
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      <str>  UUID of the batch to be processed. [required]    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        <str>    Type of batch to be dealt with, e.g.         │
│                                 'vendor_catalog'                             │
│                                 [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.          │
│    --help                       Show this message and exit.                  │
╰──────────────────────────────────────────────────────────────────────────────╯
rattail.commands.batch.make_batch(ctx: Context, batch_type: Annotated[str, <typer.models.ArgumentInfo object at 0x7f1a696e4490>]=Ellipsis, input_file: Path, <typer.models.OptionInfo object at 0x7f1a696e4550>]=Ellipsis, create_kwargs: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4610>]=None, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e46d0>]=False)[source]

Make a new batch, from a data file

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'make-batch', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 Usage: rattail make-batch [OPTIONS] {batch_type}                               
                                                                                
 Make a new batch, from a data file                                             
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_type      <str>  Type of batch to be created, e.g.                │
│                             'vendor_catalog'                                 │
│                             [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.)          │
│                                 [required]                                   │
│    --kwargs            <loads>  Optional JSON-encoded string containing      │
│                                 extra keyword arguments to be passed to the  │
│                                 handler's batch creation logic.              │
│    --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: Context, batch_type: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4110>]=Ellipsis, batch_uuid: Annotated[str, <typer.models.ArgumentInfo object at 0x7f1a696e4210>]=Ellipsis, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e43d0>]=False)[source]

Populate initial data for a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'populate-batch', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 Usage: rattail populate-batch [OPTIONS] {batch_uuid}                           
                                                                                
 Populate initial data for a batch                                              
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      <str>  UUID of the batch to be processed. [required]    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        <str>  Type of batch to be dealt with, e.g.           │
│                               'vendor_catalog'                               │
│                               [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: Context, list_types: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e65d0>]=False, batch_type: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e66d0>]=Ellipsis, before: datetime, <typer.models.OptionInfo object at 0x7f1a696e6650>]=None, before_days: Annotated[int, <typer.models.OptionInfo object at 0x7f1a696e6750>]=90, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e6850>]=False)[source]

Purge old batches from the database

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'purge-batches', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 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         <str>       Type of batch to be purged, e.g.         │
│                                     'vendor_catalog'                         │
│                                     [required]                               │
│    --before             <%Y-%m-%d>  Purge all batches executed prior to this │
│                                     date.  If not specified, will use        │
│                                     --before-days to calculate instead.      │
│    --before-days        <int>       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: Context, batch_type: Annotated[str, <typer.models.OptionInfo object at 0x7f1a696e4110>]=Ellipsis, batch_uuid: Annotated[str, <typer.models.ArgumentInfo object at 0x7f1a696e4210>]=Ellipsis, dry_run: Annotated[bool, <typer.models.OptionInfo object at 0x7f1a696e43d0>]=False)[source]

Refresh data for a batch

DEBUG [wuttjamaican.conf][MainThread] configured logging
DEBUG [wuttjamaican.conf][MainThread] sys.argv: ['/mnt/buildbot/worker/rattail/build/.tox/docs/bin/rattail', 'refresh-batch', '--help']
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.schemas
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.tables
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.types
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.constraints
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.defaults
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.plugins][MainThread] setup plugin alembic.ext.checkconstraint_byname
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
DEBUG [wuttjamaican.conf][MainThread] app handler spec is rattail.app:AppHandler
                                                                                
 Usage: rattail refresh-batch [OPTIONS] {batch_uuid}                            
                                                                                
 Refresh data for a batch                                                       
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│ *    batch_uuid      <str>  UUID of the batch to be processed. [required]    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ *  --batch-type        <str>  Type of batch to be dealt with, e.g.           │
│                               'vendor_catalog'                               │
│                               [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.                    │
╰──────────────────────────────────────────────────────────────────────────────╯