Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • autosubmit autosubmit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 338
    • Issues 338
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 21
    • Merge requests 21
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • autosubmitautosubmit
  • Issues
  • #1145
Closed
Open
Issue created Oct 10, 2023 by Oriol Tintó-Prims@otintoMaintainer

Custom autosubmitrc path?

Hello @dbeltran, @bdepaula, @mcastril

Summary

As you already know, we are setting up a centralized installation of autosubmit at LMU.

The small issue that we have is that in our system, the workstations don't share the /etc/ folder, so we would need to replicate the configuration file in every workstation. Doable but not very convenient. A colleague at LMU suggested that a solution that would be more convenient would be to use an environment variable to specify where the configuration file is (i.e. AUTOSUBMIT_CONFIGURATION). In that way, we would be able to just set this variable in the corresponding autosubmit module file and keep the configuration file in any place, without being forced to put it in /etc/.

The implementation of this would require very few lines of code and I don't see many disadvantages:

    @staticmethod
    def read():
        """
        Reads configuration from .autosubmitrc files, first from /etc., then for user
        directory and last for current path.
        """
        filename = 'autosubmitrc'

        BasicConfig.__read_file_config(os.path.join('/etc', filename))
        BasicConfig.__read_file_config(os.path.join(
            os.path.expanduser('~'), '.' + filename))
        BasicConfig.__read_file_config(os.path.join('', '.' + filename))
        # Check if the environment variable is defined
        if 'AUTOSUBMIT_CONFIGURATION' in os.environ:
           config_file_path = os.environ['AUTOSUBMIT_CONFIGURATION']
           # Call read_file_config with the value of the environment variable
           BasicConfig.__read_file_config(config_file_path)

        BasicConfig._update_config()
        return

I tried it myself and it works.

What do you think?

Any other relevant information(if applicable)

()

Assignee
Assign to
Time tracking