
Directory Structure
Getting Started With Deployment
To deploy a job, you’ll need a workspace. If you don’t have one, you can create it using this guide: Creating a Workspace or seek assistance from your cluster administrator in case you don’t have permission to create a workspace.
- Select a workspace to deploy the job. This basically decides which cluster and environment the job will be deployed to.
- Select the Job option since this is a job.
- We chose the Github option since the code is already pushed to a Github repository.
Repo Url
: This is the URL of the Github repository that contains the code for the job. For this example, the repo url is https://github.com/truefoundry/getting-started-examplesPath to build context
: This is the path to the directory in the Github repository that contains the code for the job. For this example, the path to the build context is./train-model/
Command
: This is the command to run the job. For this example, the command ispython train.py
View your deployed job
Congratulations! You’ve successfully deployed your job. Once you clickSubmit
, your deployment will be successful in a few seconds, and your job will be displayed as Suspended, indicating that it’s successfully deployed but not running.
You can view all the information about your job following the steps below:
Configure Job Trigger
You can trigger your job manually by clicking the
Run Job
button on the dashboard or programatically. You can find more details about how to trigger your job programatically in the dashboard itself by selecting Run Job Programatically
.Terminate your job
To terminate your job, you can click theTerminate
button on the dashboard.
FAQ
How to omit certain files from being built and deployed?
How to omit certain files from being built and deployed?
It’s possible there are certain files in your repository that you don’t want to package in the docker image like like test files, etc.To exclude specific files from being built and deployed, create a .tfyignore file in the root directory of your project. The
.tfyignore
file follows the same rules as the .gitignore
file.If your repository already has a
.gitignore
file, you don’t need to create a .tfyignore
file. Truefoundry will automatically detect the files to ignore.Where is the docker image built?
Where is the docker image built?
If you are deploying from a Github repository, the docker image is built in Truefoundry control-plane and pushed to your configured container registry.If you are deploying code from your local machine, the Truefoundry SDK first checks is docker is installed on your local environment.
It tries to build using the locally installed Docker, failing which it uses the remote builder on the Truefoundry control-plane. If docker is not installed, the SDK will use the remote builder on the Truefoundry control-plane.
How can I run the job in some interval?
How can I run the job in some interval?
You need to use the cron string format to specify job schedule. The cron expression consists of five fields representing the time to execute a specified command.For example,
0 11 1 * *
represents “first day of every month at 11:00 AM”, or30 9 * * 1
represents “every Monday at 9:30 AM”We can use a site like https://crontab.guru/ to tryout cron expression and get a human-readable description of the same.What if a job is still running until the next scheduled run?
What if a job is still running until the next scheduled run?
Say for example, you schedule a daily job which runs at midnight to process and store some data in an S3 bucket but for some reason it is still running even at next midnight. So it is possible that the previous run of the job hasn’t been completed while it is already time for the job to run again as per schedule. What should happen in this case? Should we:
- Skip the new run and continue the current run
- Stop the ongoing run and start the new one, or
- Run both in parallel
Forbid
: This is the default. Do not allow concurrent runs.Allow
: Allow jobs to run concurrently.Replace
: Replace the current job with the new one.