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
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:
- Open a terminal session.
In your terminal session, run the setup wizard.
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
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_FILEenvironment variable inside the container:
TRAINS_CONFIG_FILE = MyOtherTrains.conf
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:
At the command prompt
Paste copied configuration here:, copy and paste the Trains credentials you create as follows:
Open the Trains Web-App (UI) in your browser.
Click the PROFILE page.
Click Create new credentials.
Click Copy to clipboard.
In your terminal session, paste your credentials and press Enter. The setup wizard confirms the credentials.
Detected credentials key="********************" secret="*******"
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]
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]
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 -
- Windows -
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:
Open your Trains configuration file for editing. Depending upon your operating system, it is:
- Linux -
- macOS -
- Windows -
- Linux -
sdk.developmentsection, add the logging of environment variables option (see
log_os_environmentsin 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: 
Save your Trains configuration file. Trains is now configured for your Trains Server.
- 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.