This guide explains how initialization and custom scripts are configured and executed across different levels within the Syntasa platform when working with Notebook Processes. Understanding these layers helps ensure consistent environment setup, automation, and platform-wide configuration management.
Initialization scripts can be defined at three levels:
- Notebook Card (Object Level)
- Runtime Template (Template Level)
- Infrastructure Settings (Global Level)
Each level serves a different purpose and scope.
Overview of Script Levels
Initialization scripts enable automated setup of environments by running predefined commands during runtime startup. Depending on where the script is configured, it may apply to a single notebook process, a runtime template, or the entire platform.
Notebook Card Initialization Script
The Initialization Script configured at the Notebook Card level applies specifically to an individual notebook or notebook process. This script prepares the runtime environment whenever the notebook is launched, or notebook process is executed.
Location
Navigate to:
Notebook Creation or Edit Screen → Initialization Script field
Language
- Bash scripting
Execution Behavior
- Executes every time the notebook is launched.
- Runs after infrastructure and runtime template scripts.
Primary Use Cases
- Installing notebook-specific libraries.
Example:
pip install <library_name>
- Setting environment variables required for a particular notebook process.
- Downloading small configuration files or sample datasets.
- Performing lightweight setup tasks specific to one notebook.
When to Use
Use notebook-level initialization when configuration is unique to a single notebook process and should not affect other users or runtimes.
Custom Script in Runtime Settings
Runtime-level custom scripts are defined within Runtime Templates. These scripts apply to all notebook process, jobs, or interactive applications that use that specific runtime template.
Location
Navigate to:
Resources → Runtime → Runtime template (New/Edit) → Custom Script section
Scope
- Template-level configuration.
- Affects all instances created from the selected runtime template.
Execution Behavior
- Runs during provisioning or startup of the runtime environment (for example, Kubernetes containers or Dataproc clusters).
- Executes before notebook process specific initialization scripts.
Primary Use Cases
- Installing commonly used data science libraries across environments:
pip install numpy scipy matplotlib
- Configuring operating system settings or container environments.
- Running authorization scripts or connecting to external services.
- Setting standardized environment configurations for teams.
Runtime Script Features
| Feature | Description |
|---|---|
| Configuration | Define environment or Spark parameters. |
| Custom Script | Execute shell commands to install software or perform setup actions. |
When to Use
Choose runtime-level scripts when configuration needs to be shared across multiple notebook process using the same runtime template.
3. Custom Script in Infrastructure Settings (Global Level)
Infrastructure-level scripts provide a global configuration applied across the entire platform. This is the highest level of initialization control.
Location
Navigate to:
Settings (Gear Icon) → Admin Centre → Infrastructure → Notebook Runtime Script
Scope
- Global (applies to all notebook runtimes across the platform).
Execution Behavior
- Executes during the global initialization phase.
- Typically runs before runtime template and notebook-specific scripts.
Primary Use Cases
- Enforcing platform-wide logging or monitoring.
- Configuring proxy settings or security certificates.
- Standardizing base environments for organizational compliance.
- Setting global environment variables.
Example:
echo "Initializing global runtime"
When to Use
Use infrastructure-level scripts for organizational standards and configurations that must apply consistently to all notebook process.
Execution Order
Initialization scripts execute in the following sequence:
- Infrastructure-level scripts (Global)
- Runtime template scripts (Template)
- Notebook card initialization scripts (Object)
This hierarchy ensures that global configurations are applied first, followed by shared runtime setup, and finally notebook-specific customizations.
Permissions and Access
- Infrastructure Scripts — Typically require System Admin privileges.
- Runtime Template Scripts — Usually require Admin or Data Engineer permissions.
- Notebook Initialization Scripts — Can be modified by users with access to the notebook.
Persistence and Runtime Behavior
- Scripts run automatically each time a runtime is launched.
- If a runtime stops and restarts, scripts execute again to maintain environment consistency.
- Initialization scripts should be idempotent to avoid conflicts during repeated execution.
Summary of Differences
| Level | Location | Scope | Best For |
|---|---|---|---|
| Infrastructure | Admin Centre → Infrastructure | Global (All Notebooks) | Corporate standards, security settings, global logging. |
| Runtime Template | Resources → Runtime | Template-specific | Shared libraries, OS configurations, runtime setup. |
| Notebook Card | Notebook Edit Screen | Object-specific | Notebook-level libraries and temporary configurations. |