# Create a function

Note

Cognite AIR and Cognite Functions are not enabled by default. Contact support@cognite.com to enable them for your CDF project.

Before you deploy a function, you must set up GitHub and GitLab.

  1. Edit the config.yaml to your liking. This file handles the interaction with the AIR infrastructure and the application. Read more about it.

  2. We recommend useing the AIR client to get all the benefits of retrieving information about schedules, writing versioned time series and events, sending notifications to the end-user, and visualizing calculated time series in the front end. In addition, AIR is using Cognite Functions (opens new window).

  3. Add all required libraries for your function to the requirements.txt file. Make sure to add the air-sdk library to the requirements for every project.

  4. Install all packages to poetry since they are needed for unit and integration tests.

  5. Navigate to the repoconfig.yaml file in the root folder. Under the project properties tab, make sure to add a mapping value as follows PROJECT_NAME: [PROJECT_URL, "PROJECT_NAME_API_KEY"]. Under the ProjectFunctionMap, write the name of the function that needs to be deployed and the project you wish to deploy to.

  6. Testing can be done by making use of a test handler under the test folder in your function_name folder.

  7. If an existing function should not be deployed, the folder name needs to be added to the .ignore_models file.

  8. Once the function is ready, add, commit, and push it to open a pull request.

Last Updated: 11/2/2021, 7:56:54 AM