Metadata-Version: 2.4
Name: gbatchkit
Version: 1.0a6
Summary: Toolkit for running Google Cloud Batch jobs
Author-email: David Haley <dchaley@gmail.com>
License: Boost Software License - Version 1.0 - August 17th, 2003
        
        Permission is hereby granted, free of charge, to any person or organization
        obtaining a copy of the software and accompanying documentation covered by
        this license (the "Software") to use, reproduce, display, distribute,
        execute, and transmit the Software, and to prepare derivative works of the
        Software, and to permit third-parties to whom the Software is furnished to
        do so, all subject to the following:
        
        The copyright notices in the Software and this entire statement, including
        the above license grant, this restriction and the following disclaimer,
        must be included in all copies of the Software, in whole or in part, and
        all derivative works of the Software, unless such copies or derivative
        works are solely in the form of machine-executable object code generated by
        a source language processor.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
        SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
        FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
        DEALINGS IN THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/redwoodconsulting-io/gbatchkit-python
Keywords: batch,cloud,google,platform,gcp
Classifier: License :: OSI Approved :: Boost Software License 1.0 (BSL-1.0)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Development Status :: 2 - Pre-Alpha
Requires-Python: <=3.14,>=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic
Requires-Dist: smart_open[gcs]
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: bumpver; extra == "dev"
Requires-Dist: callee; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# gbatchkit-python
Google Cloud Platform Batch Kit (GBK)

## Why GBatchKit?

GCP Batch is a powerful serverless computing platform. `gbatchkit` provides lightweight tools to use Batch more effectively.

Key features:

* Create a straightforward job easily. This will run `my-script.py` in the given container on Batch.

  ```python
  container_uri = "container_uri"
  runnable = ContainerRunnable(
    image_uri=container_uri,
    entrypoint="python",
    commands=["my-script.py"]
  )
  task_count = 1
  job = create_standard_job(region, compute_config, task_count, [runnable])
  submit_job(job, "my_unique_job_id", region)
  ```

  * Also supports:
    * Customize the `service_account` and `network_interface` used to run the job.
    * Allocate a persistent disk for temp files.
    * Add dependency to other jobs (GCP Batch public preview feature).

* Create multi-task jobs (for one or multiple runnables).

  * Uses Google Cloud Storage to store task arguments.

  ```python
  task_arguments = [{"a": 1, "b": 2}, {"a": 3, "b": 4}]
  job = create_standard_job(region, compute_config, len(task_arguments), runnable)
  working_directory = "gs://a-bucket/a-directory/jobs"
  prepare_multitask_job(job, working_directory, tasks=task_arguments)
  submit_job(job, "my_unique_job_id", region)
  ```

  * Supports different arguments per runnable. In this example, the 1st runnable python script takes arguments `a` and `b` and the second runnable python script takes arguments `c` and `d`. Note that Batch requires all runnables to have the same number of tasks.

    ```python
    container_uri = "container_uri"
    runnable1 = ContainerRunnable(
      image_uri=container_uri,
      entrypoint="python",
      commands=["script1.py"]
    )
    runnable2 = ContainerRunnable(
      image_uri=container_uri,
      entrypoint="python",
      commands=["script2.py"]
    )
    task_arguments = [
      [{"a": 1, "b": 2}, {"a": 3, "b": 4}],
      [{"c": 1, "d": 2}, {"c": 3, "d": 4}],
    ]
    
    job = create_standard_job(region, compute_config, task_count=2, runnables=[runnable1, runnable2])
    working_directory = "gs://a-bucket/a-directory/jobs"
    prepare_multitask_job(job, working_directory, tasks=task_arguments)
    
    submit_job(job, "my_unique_job_id", region)
    ```

    
