Skip to content

Initialization of test profile#29

Draft
agoscinski wants to merge 1 commit intophase1from
add-test-env
Draft

Initialization of test profile#29
agoscinski wants to merge 1 commit intophase1from
add-test-env

Conversation

@agoscinski
Copy link
Copy Markdown
Contributor

@agoscinski agoscinski commented Nov 26, 2025

Support for Airflow in AiiDA profile

Introduces profile creation in utils/profile.py to store
information about the Airflow configuration in the AiiDA profile.

In addition scripts have been created that expose the profile management
functions in form of a CLI that will be later merged into the AiiDA CLI.
Only PostgreSQL is for now supported.

The test profile is created using these utilities to allow easier
debugging by having direct access to the test profile.

Key features:

  • Profile creation with integrated Airflow database setup
  • Automatic extraction of Airflow environment from profile configuration
  • Profile verification to ensure Airflow support
  • Proper teardown of both AiiDA and Airflow databases/users

Implementation details:

  1. Profile Management (utils/profile.py):

    • create_aiida_profile(): Creates AiiDA profile with Airflow support
    • delete_aiida_profile(): Removes profile and cleans up databases/users
    • create_psql_database_from_aiida_profile(): Creates separate AiiDA and Airflow databases
    • delete_psql_database_from_aiida_profile(): Drops databases and users using admin credentials
    • verify_profile_supports_airflow(): Validates required Airflow configuration keys
    • from_profile_create_airflow_env(): Extracts Airflow environment variables from profile
    • Uses admin credentials in delete also to also delete the psql database
  2. CLI Scripts:

    • scripts/cmd_profile_create.py: Creates new AiiDA profiles with Airflow support
    • scripts/cmd_profile_delete.py: Deletes profiles with verification and cleanup
    • scripts/cmd_airflow.py: Executes Airflow CLI commands with profile environment
      (uses direct argument pass-through to support Airflow flags like -B)

Technical notes:

  • Separate for AiiDA and Airflow, potentially same
  • Admin credentials required for database/user deletion (PostgreSQL restriction)
  • Profile verification ensures Airflow configuration is present before operations
  • AIRFLOW_HOME stored in profile's config directory: <aiida_config>/<aiida_profile>/airflow


# Check if profile already exists
# TODO think about when psql database exist but aiida profile was not successfully created
teardown_dbuser_from_aiida_profile(profile_name, pg_host, pg_port, pg_user, pg_password)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont forget this to hnandle differentl

@agoscinski agoscinski force-pushed the add-test-env branch 2 times, most recently from abb9659 to b33fead Compare December 1, 2025 08:17
Introduces profile creation in utils/profile.py to store
information about the Airflow configuration in the AiiDA profile.

In addition scripts have been created that expose the profile management
functions in form of a CLI that will be later merged into the AiiDA CLI.
Only PostgreSQL is for now supported.

The test profile is created using these utilities to allow easier
debugging by having direct access to the test profile.

Key features:
- Profile creation with integrated Airflow database setup
- Automatic extraction of Airflow environment from profile configuration
- Profile verification to ensure Airflow support
- Proper teardown of both AiiDA and Airflow databases/users

Implementation details:

1. Profile Management (utils/profile.py):
   - create_aiida_profile(): Creates AiiDA profile with Airflow support
   - delete_aiida_profile(): Removes profile and cleans up databases/users
   - setup_dbuser_from_aiida_profile(): Creates separate AiiDA and Airflow databases
   - teardown_dbuser_from_aiida_profile(): Drops databases and users using admin credentials
   - verify_profile_supports_airflow(): Validates required Airflow configuration keys
   - from_profile_create_airflow_env(): Extracts Airflow environment variables from profile
   - Uses admin credentials (pg_admin_*) to properly handle PostgreSQL operations
   - Configure secrets for communication between scheduler, api-server and triggerer

2. CLI Scripts:
   - scripts/cmd_profile_create.py: Creates new AiiDA profiles with Airflow support
   - scripts/cmd_profile_delete.py: Deletes profiles with verification and cleanup
   - scripts/cmd_airflow.py: Executes Airflow CLI commands with profile environment
     (uses direct argument pass-through to support Airflow flags like -B)

Technical notes:
- Separate for AiiDA and Airflow, potentially same
- Admin credentials required for database/user deletion (PostgreSQL restriction)
- Profile verification ensures Airflow configuration is present before operations
- AIRFLOW_HOME stored in profile's config directory: <aiida_config>/<profile>/airflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant