Configuring Trains for Trains Server

After deploying Trains Server, you must configure Trains for it by either:

  • Initializing a new Trains configuration file using our interactive setup.
  • Adding Trains settings to an existing Trains configuration file.

Why would a Trains configuration file already exist?

If you previously configured Trains for the demo Trains Server, or installed and configure Trains Agent, you may have an existing configuration file. This is because Trains and Trains Agent use the same configuration file, but not all the same configuration options.

Initializing a new Trains configuration file

Use our trains-init setup wizard to initialize a new Trains configuration file.

If you already have a configuration file, the setup wizard will notify you and you can add Trains settings to an existing Trains configuration file.

To initialize a new Trains configuration file:

  1. Open a terminal session.
  2. In your terminal session, run the setup wizard.

    trains-init
    

    If the setup wizard's response indicates you already have a configuration file, then perform the steps in the Adding Trains settings to an existing Trains configuration file section. The wizard does not edit or overwrite existing configuration files.

    Additional Trains configuration files

    You can create additional Trains configuration files using the --file option of trains-init.

    For example, create a configuration file to use inside Docker containers when executing a Task:

    trains-init --file MyOtherTrains.conf
    

    and then specify it using the TRAINS_CONFIG_FILE environment variable inside the container:

    TRAINS_CONFIG_FILE = MyOtherTrains.conf
    

    For more information about running experiments inside Docker containers, see the Trains Agent Use Case Examples and Trains Agent Reference pages.

    The setup wizard prompts for your Trains credentials.

    TRAINS SDK setup process
    
    Please create new trains credentials through the profile page in your trains web app (e.g. http://localhost:8080/profile)
    In the profile page, press "Create new credentials", then press "Copy to clipboard".
    
    Paste copied configuration here:
    
  3. At the command prompt Paste copied configuration here:, copy and paste the Trains credentials you create as follows:

    1. Open the Trains Web-App (UI) in your browser.

    2. Click the PROFILE page.

    3. Click Create new credentials.

    4. Click Copy to clipboard.

    5. In your terminal session, paste your credentials and press Enter. The setup wizard confirms the credentials.

      Detected credentials key="********************" secret="*******"
      
  4. Enter the Trains Server web server URL, or press Enter to accept the default which is detected from your credentials.

    WEB Host configured to: [https://demoapp.trains.allegro.ai]
    
  5. Enter the Trains Server API server URL, or press Enter to accept the default value which is based on your previous response:

    API Host configured to: [https://demoapi.trains.allegro.ai]
    
  6. Enter the Trains Server file server URL, or press Enter to accept the default value which is based on your previous response:

    File Store Host configured to: [https://demofiles.trains.allegro.ai]
    

    The wizard responds with your configuration and directs you to your Trains Server.

    TRAINS Hosts configuration:
    Web App: https://demoapp.trains.allegro.ai
    API: https://demoapi.trains.allegro.ai
    File Store: https://demofiles.trains.allegro.ai
    
    Verifying credentials ...
    Credentials verified!
    
    New configuration stored in /home/<username>/trains.conf
    TRAINS setup completed successfully.
    

    The configuration file's location depends upon your operating system:

    • Linux - ~/trains.conf`
    • Mac - $HOME/trains.conf
    • Windows - \User\<username>\trains.conf

Adding Trains settings to an existing Trains configuration file

If a Trains configuration file already exists, add Trains settings to it. Add an api section containing your Trains Server web server, API server, and file server URLs, and your Trains credentials from the Trains Web-App (UI).

The URLs for your Trains Server are required:

  • Trains Server web server
  • Trains Server API server
  • Trains Server file server

These may be localhost, your domain, or a sub-domain of your domain.

To add Trains settings to an existing Trains configuration file:

  1. Open your Trains configuration file for editing. Depending upon your operating system, it is:

    • Linux - ~/trains.conf
    • macOS - $HOME/trains.conf
    • Windows - \User\<username>\trains.conf
  2. In the sdk.development section, add the logging of environment variables option (see log_os_environments in an example configuration file).

    # Log specific environment variables. OS environments are enlisted in the "Environment" section
    # of the Hyper-Parameters.
    # multiple selected variables are supported including the suffix '*'.
    # For example: "AWS_*" will log any OS environment variable starting with 'AWS_'.
    # This value can be overwritten with os environment variable TRAINS_LOG_ENVIRONMENT="[AWS_*, CUDA_VERSION]"
    # Example: log_os_environments: ["AWS_*", "CUDA_VERSION"]
    log_os_environments: []
    
  3. Save your Trains configuration file. Trains is now configured for your Trains Server.

Next Steps

  • You can now use the Trains Python Client package in your Python experiment scripts and your Trains Server. When you run an experiment script, the experiment is stored in your Trains Server.
  • If you install and configure Trains Agent for your Trains Server, you can use Task remote execution to manage your experimentation.