# aws-deadline/deadline-cloud-for-keyshot architecture

> Architecture diagram of the GitHub repository aws-deadline/deadline-cloud-for-keyshot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-deadline/deadline-cloud-for-keyshot
- Repository: https://github.com/aws-deadline/deadline-cloud-for-keyshot

## Overview

##### Main System Components
- Submitter Component: Represented by the KeyShot submitter source code (located in src/deadline/keyshot_submitter) and its associated installation files. This component is responsible for running inside KeyShot’s Scripting Console, extracting scene info, packaging it appropriately (including converting file paths for attachments and generating a job bundle), and then initiating the job submission.
- Adaptor Component: Found in src/deadline/keyshot_adaptor along with its client counterpart (KeyShotClient). It implements the OpenJD adaptor interface, launching KeyShot on the worker hosts and handling the “sticky” session for rendering.
- AWS Deadline Cloud Interaction: Although the package itself isn’t implementing AWS services, the submitter and adaptor work together to create and submit a Job Bundle to the Deadline Cloud. Represent this external dependency with an “AWS Deadline Cloud Service” component.
- Testing Components: The “test” directory is organized into unit tests, integration tests, and installer tests. Although not a part of the runtime architecture, these components assure quality and could be mentioned as ensuring the reliability of the core system.

##### Relationships and Interactions
- The KeyShot Submitter (installed as a script in KeyShot) interacts with the local KeyShot application and collects the scene file and external references.
- After processing the scene, the submitter uses logic in the adaptor (or communicates with a client module) to generate an Open Job Description template and job bundle.
- The job bundle is then submitted through AWS Deadline Cloud’s client interface (using the Deadline client library) to the rendering farm (which may be service-managed or customer-managed).
- On the worker side, the KeyShot Adaptor is installed. Its job is to read the job payload, start KeyShot (or use keyshot_headless.exe), and process the render job.
- There is a clear directional data flow: KeyShot Interface (Submitter) → Job Bundle Generation → AWS Deadline Cloud (job submission) → Worker hosts (with Adaptor) → KeyShot rendering.

##### Architectural Patterns and Design Principles
- Modularity: The system is split into distinct modules (submitter, adaptor, client) to separate concerns.
- Extensibility: Leveraging the OpenJD adaptor runtime means the system is designed to support adaptation for standard job descriptions.
- Automation: CI/CD pipelines (via GitHub Actions and pipeline scripts) automate the build, test, and release process, which can be depicted as a supporting environment.
- Cross-Platform Elements: Although the primary job submission and rendering are handled differently on Windows and macOS (as mentioned in the README), focus on the overall integration rather than OS-specific details.

##### Relevant Technologies and Frameworks
- Python 3.9+, used throughout the project.
- KeyShot integration, leveraging its scripting interface.
- AWS Deadline Cloud for submission and management of rendering jobs.
- OpenJD Adaptor Runtime for Python.
- GitHub Actions, pipeline scripts, and CI/CD related tools for quality and release management.

- Module has a clear label.
- Optionally, include small notes next to each component indicating key technologies (e.g., “Python 3.9”, “OpenJD Adaptor”, “Deadline Cloud Client”) for clarity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% KeyShot Environment
    subgraph "KeyShot Environment"
        SUBMITTER["KeyShot Submitter (Python 3.9)"]:::local
    end

    %% Job Processing
    subgraph "Job Processing"
        JOBBUNDLE["Job Bundle Creation & OpenJD Template Generator (OpenJD)"]:::local
    end

    %% Cloud Service
    subgraph "Cloud Service"
        AWS["AWS Deadline Cloud Service"]:::external
    end

    %% Worker Hosts
    subgraph "Worker Hosts"
        ADAPTOR["KeyShot Adaptor (OpenJD Adaptor)"]:::worker
        CLIENT["KeyShot Client"]:::worker
    end

    %% CI/CD & Build Infrastructure
    subgraph "CI/CD & Build Infrastructure"
        CI["GitHub Actions Workflows (CI/CD)"]:::ci
        PIPELINE["Pipeline Scripts & Installer"]:::ci
    end

    %% Testing Components
    subgraph "Quality Assurance"
        TEST["Testing Components"]:::testing
    end

    %% Data Flow
    SUBMITTER -->|"ExtractSceneInfo"| JOBBUNDLE
    JOBBUNDLE -->|"SubmitJobBundle"| AWS
    AWS -->|"DistributeJobPayload"| ADAPTOR
    ADAPTOR -->|"InitiateRender"| CLIENT

    %% Click Events
    click SUBMITTER "https://github.com/aws-deadline/deadline-cloud-for-keyshot/blob/mainline/src/deadline/keyshot_submitter/Submit to AWS Deadline Cloud.py"
    click ADAPTOR "https://github.com/aws-deadline/deadline-cloud-for-keyshot/tree/mainline/src/deadline/keyshot_adaptor/KeyShotAdaptor"
    click CLIENT "https://github.com/aws-deadline/deadline-cloud-for-keyshot/tree/mainline/src/deadline/keyshot_adaptor/KeyShotClient"
    click CI "https://github.com/aws-deadline/deadline-cloud-for-keyshot/tree/mainline/.github/workflows"
    click PIPELINE "https://github.com/aws-deadline/deadline-cloud-for-keyshot/tree/mainline/pipeline"
    click TEST "https://github.com/aws-deadline/deadline-cloud-for-keyshot/tree/mainline/test"

    %% Styles
    classDef local fill:#D6EAF8,stroke:#1F618D,stroke-width:2px;
    classDef external fill:#FDEDEC,stroke:#CB4335,stroke-width:2px;
    classDef worker fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef ci fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px;
    classDef testing fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
```
