# Utility Actions

## Accessing Utility Actions

Navigate to the ***Workspace*** tab for an activated project.

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The imported Utility files from the system will not support **Push to VCS** and **Pull from VCS** actions.*
* *The same Actions functionality is available for a .py file under a Repo Sync project.*
  {% endhint %}

## Edit

The user can modify the content of a utility script using the ***Edit*** option.

* Navigate to the ***Workspace*** tab for a normal Data Science Lab project.
* Click on the ***Utils*** folder.
* Select the ***Ellipsis*** icon provided for a Utility file.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FC9HXO6EkXOef8g17bvnl%2Fimage.png?alt=media&#x26;token=b86b5374-9375-4553-88bc-9b52f40cef59" alt=""><figcaption></figcaption></figure>

* Select the ***Edit*** option from the context menu that opens for a Utility file.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FY1ExiHwE6OEPWioMvpzq%2Fimage.png?alt=media&#x26;token=b99d5c24-2ad5-46a1-b455-efce2bc7e9d7" alt=""><figcaption></figcaption></figure>

* The Edit Utility File window opens displaying the Utility script content.
* Modify the script content.
* Click the ***Validate*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F1guKF3VthfSZ9INMMk6i%2Fimage.png?alt=media&#x26;token=817ae221-de7c-4ebd-8a4c-926456961063" alt=""><figcaption></figcaption></figure>

* A notification ensures the script is valid post modification in the script content.&#x20;
* Click the ***Update*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FvYp7iTQBmYyLntBOT7xb%2Fimage.png?alt=media&#x26;token=615beacf-b317-4515-b1e5-39c1a0c681f3" alt=""><figcaption></figcaption></figure>

* A notification ensures that the utility script is updated.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FyAKwfcX4EDQAwJnTdXPx%2Fimage.png?alt=media&#x26;token=648c5b89-a6c0-48fa-b3e5-690cad47311a" alt=""><figcaption></figcaption></figure>

## Push into VCS & Pull from VCS

### Push Pre-requisites

{% hint style="warning" %} <mark style="color:orange;">Pre-requisites:</mark>

1. The user branch should have Developers' + maintainers' permission to push the latest code into the Main branch.
2. The User token has to be set in the user profile using the Custom Fields setting available at the Admin level.
3. The user token key name has to be '**bdbvcstoken'**.
   {% endhint %}

* Navigate to the ***Admin*** module.
* Open the ***Custom Field Settings*** under the ***Configurations*** option.
* The ***Custom Field*** Information appears.
* Provide the following information for the custom field:
  * Key- ***bdbvcstoken***
  * &#x20;Input type *- Manual*
  * Description - Git User Token
  * &#x20;*Mandatory - No*
* Click the ***Save*** option to save the modified ***Custom Field Settings***.
* A notification message informs the user that the custom field settings are updated.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FhRgqAN8gowct4AGJWMRi%2Fimage.png?alt=media&#x26;token=92073922-5743-4884-adbb-76dbfbc09f7a" alt=""><figcaption></figcaption></figure>

* Navigate to the ***Security*** module.
* Go to the ***Users*** list.
* Select the user from the list.
* Click the ***Edit*** icon.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FrkpngCV7wzTwyGiaDFIH%2Fimage.png?alt=media&#x26;token=2026bd78-b228-48da-90b7-09cf22743fd9" alt=""><figcaption></figcaption></figure>

* The ***Update User*** page opens.
* Check out the ***Custom Fields*** section.&#x20;
* ***Validate*** whether the ***Git User Token*** is valid or not. If not ***provide the valid Git User Token***.
* Click the ***Save*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fsk0g2ExuI4VjUI0cGcUV%2Fimage.png?alt=media&#x26;token=73dec675-1cd0-4676-ab70-44dee3c16d88" alt=""><figcaption></figcaption></figure>

A notification message appears to inform that the user is updated successfully.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FIojwSYykiKOLmrCJvxdd%2Fimage.png?alt=media&#x26;token=2c73a82f-29e9-4812-946f-2a884bbce4e4" alt=""><figcaption></figcaption></figure>

* Open the ***User Profile***.
* Select the ***My Account*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FOmP6YMJAqYTMImljnLRk%2Fimage.png?alt=media&#x26;token=a1632b29-ee5e-4d2d-b73c-7764f5a980d0" alt=""><figcaption></figcaption></figure>

* The ***My Account*** details are displayed.
* Open the ***Configuration*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fppqx1TIL8fJg2iDVyyRD%2Fimage.png?alt=media&#x26;token=f54eb3ad-bf05-468d-a8d0-89fa23a307df" alt=""><figcaption></figcaption></figure>

* The same token gets updated as the ***Git Token*** section provided under the ***Configuration*** section.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FR48CqsCen3lEE7gQwt22%2Fimage.png?alt=media&#x26;token=fc5ad4d3-88bd-434b-acdb-ab57e9b2a593" alt=""><figcaption></figcaption></figure>

### Pull Pre-requisites

The user can also pull a utility script or an updated version of the utility script from the Git Repository.&#x20;

{% hint style="warning" %}
*<mark style="color:orange;">Pre-requisite:</mark>*&#x20;

* *The user needs to do an **Admin configuration** with an authentication token.*&#x20;
* *The user needs to do the **Project** level- configuration of **Git Project** and **Git branch**.*
  {% endhint %}

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The normal Data Science Project with the Git branch configured to it will support the **Pull from Git** import functionality for a utility file.*&#x20;
* *Users can generate an authentication token from their **Git Lab** or **Hub** repositories.*
  {% endhint %}

### Admin Level Configuration for  Git Pull

* Navigate to the ***Admin*** module.
* Open the ***Version Control*** from the ***Configuration*** options.
* Select the Token type as a private token.
* Provide the authentication token in the given space.
* Click the ***Test*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FQmhdI8LOeJzlRtEL1Rkf%2Fimage.png?alt=media&#x26;token=5c33a8fd-dc26-4c70-bf36-21b9a199a251" alt=""><figcaption></figcaption></figure>

* A notification message appears to inform the user that authentication has been established.
* Click the ***Save*** option.&#x20;

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F1xK4yRY6SOGCDa2zMFIe%2Fimage.png?alt=media&#x26;token=f08e64e0-d202-4ff2-a4ea-153ca22436c1" alt=""><figcaption></figcaption></figure>

* A notification message appears to inform that the version control has been updated.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FyDt7uPTtieLiBMYhHaG0%2Fimage.png?alt=media&#x26;token=b24bdecf-9136-4979-9a4a-80b704c6a552" alt=""><figcaption></figcaption></figure>

### Pushing into and Pulling a Utility File&#x20;

A user can make the changes in the pulled Python file and Push it into Git using the user token set in the user profile.&#x20;

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Before using the Push a utility file to Git functionality make sure that the following requirements are fulfilled:*

1. *The latest file is pulled into DS Lab before modifying and pushing back to the Git branch.*&#x20;
2. *The user should have access to the Git branch to push a change.*
   {% endhint %}

{% hint style="success" %}
*Check out the illustration for a utility script to understand the Pull from VCS and Push into VCS functionalities. It displays how taking each time a pull from VCS is necessary for using the Push to VCS functionality.*&#x20;
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FWz8I7SP2FgU7rE3WkRxw%2FPush%20Utils.mp4?alt=media&token=1bca5f9e-1a88-4562-88ca-cfed3dd47667>" %}
***Pull from VCS  & Push into VCS functionalities for a Utility Script***&#x20;
{% endembed %}

* Navigate to the ***Workspace*** tab for an activated project that has a Git branch configured.
* Click the ***Utils*** folder to get the Import option.
* Click the ***Import*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FACq4QQ5Ey4cVRQaMULUX%2Fimage.png?alt=media&#x26;token=4a9a71ef-8ce5-49e3-b441-5065b846047a" alt=""><figcaption></figcaption></figure>

* The ***Import Utility File*** drawer appears.
* Select the ***Pull from Git*** option.
* Select a file using the checkbox.
* Click the ***Save*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FHgeqM3uTK2YE25UuZhcc%2Fimage.png?alt=media&#x26;token=567284a0-5eff-4cc1-8b29-8f0ed65da4f9" alt=""><figcaption></figcaption></figure>

* A notification message informs that the selected file is pulled.
* The pulled file gets listed under the Utils folder.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FxEPTcDhEmIjagBH0JMtM%2Fimage.png?alt=media&#x26;token=6c83d1dc-1f79-46fa-b9f5-76608e31218b" alt=""><figcaption></figcaption></figure>

* Save the pulled file.
* Modify the content of the saved Utility file.
* Click the Pulled utility file from the Utils folder.
* Select the ***Push into VCS*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F0VncQzOl7h3gVFS2TlNV%2Fimage.png?alt=media&#x26;token=135d40ba-1bf2-4c74-ac85-7fb33649d287" alt=""><figcaption></figcaption></figure>

* The ***Push into Git*** drawer opens.
* Provide a commit message.
* Click the ***Push*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FZTRJBXQnDNxxRoeZvKsj%2Fimage.png?alt=media&#x26;token=bd3c5ae0-aed8-4ef8-a504-2cc8ddc9be8a" alt=""><figcaption></figcaption></figure>

* A notification ensures that the latest file version is pushed.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FvId2rWvoX0ReBh7LzVrz%2Fimage.png?alt=media&#x26;token=c8df4ff1-5a64-453b-9506-8283a0e2d23f" alt=""><figcaption></figcaption></figure>

* You can open the Git repository and verify the script version.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FSacjHjQ0eyZWBaR5PMJC%2Fimage.png?alt=media&#x26;token=43d44feb-758f-4c4e-ac76-58ce005e250b" alt=""><figcaption></figcaption></figure>

* Navigate to the same Utility file.
* Modify the script.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FBGP0ngsZvJJTjDGgCan7%2Fimage.png?alt=media&#x26;token=b1837e92-26ba-4bb1-9b35-0e94e2a4e22c" alt=""><figcaption></figcaption></figure>

* Save the script.
* Select the ***Push into VCS*** option from the Utility action context menu.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FzSuZaDka6dmd4RqPmzTF%2Fimage.png?alt=media&#x26;token=e363aebc-0804-4286-9e38-21db3986fecb" alt=""><figcaption></figcaption></figure>

* The ***Push into Git*** drawer opens.
* Provide a commit message.
* Click the ***Push*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FMyRbfFC1T61kk9hAebqV%2Fimage.png?alt=media&#x26;token=25bbe5b5-710a-4f7c-860d-51aa934d74d6" alt=""><figcaption></figcaption></figure>

* An error message states that the current file doesn't contain the latest version, and suggests taking the latest pull.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F8SB55DsUgEo2UgNxDCTu%2Fimage.png?alt=media&#x26;token=54b882bc-14c3-4aad-a146-bc8d31b84781" alt=""><figcaption></figcaption></figure>

* Click the ***Pull from VCS*** option for the same utility file.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FZQmoawWI23qoij5XZqkd%2Fimage.png?alt=media&#x26;token=d279f697-0f21-4002-b659-69dfb877133f" alt=""><figcaption></figcaption></figure>

* A notification ensures that the latest file is pulled.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FEb8vjA79QwxMToT2Pgxw%2Fimage.png?alt=media&#x26;token=7d0a670c-052c-4f61-92d3-24632000cffe" alt=""><figcaption></figcaption></figure>

* Use the ***Save as Notebook*** option to save it.
* Click the ***Yes*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fxn6xYY7sZapLt1IO1PLK%2Fimage.png?alt=media&#x26;token=518a1e9d-bc44-424a-a4a3-8144b6d0eead" alt=""><figcaption></figcaption></figure>

* Consecutive success notifications appear to ensure that the file is started and saved.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FCMzL2QEouZc0oDIG2UI5%2Fimage.png?alt=media&#x26;token=d2029e21-555d-49e2-82f6-40c0163e6e6a" alt=""><figcaption></figcaption></figure>

* Click the ***Push into VCS*** option for the same utility file.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F1T6QNphhBAoPDcePTisz%2Fimage.png?alt=media&#x26;token=212f99e2-2b47-4ed9-ae00-06948c87f22d" alt=""><figcaption></figcaption></figure>

* The ***Push into Git*** drawer opens.
* Provide the commit message.
* Click the ***Push*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2Fkq4NIWR8WIQuFM7Jne1S%2Fimage.png?alt=media&#x26;token=4c4a5aa9-ce5f-451e-8c7e-dec6ebcd80cd" alt=""><figcaption></figcaption></figure>

* A notification ensures that the latest file version is pushed.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FXWfn0CQc5th0PpRY4cyk%2Fimage.png?alt=media&#x26;token=25c7a836-3a47-4d32-94de-a35003400733" alt=""><figcaption></figcaption></figure>

* The same can be verified in the Git repository.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FJ5YmWwmEqefoOjr68dbh%2Fimage.png?alt=media&#x26;token=cadfa908-5467-4275-926f-742203265a12" alt=""><figcaption></figcaption></figure>

## Copy Path

The user can copy the utility file path by using this action option.

* Navigate to the ***Workspace*** tab for a normal ***Data Science Project***.
* Open the ***Utils*** folder to get the list of utility files.
* Access the Utility Actions context menu.
* Click the ***Copy path*** option from the Utility Actions context menu.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FycHuwBgE9Kv56RlGoNv2%2Fimage.png?alt=media&#x26;token=74d47787-4220-4a93-ae93-3b8c9d618c2a" alt=""><figcaption></figcaption></figure>

* Open a .ipynb file using the Repo folder.
* Add a new code cell.
* Use the ***Ctrl+V*** action to paste the copied path of the utility file in the code cell.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F9nFMtv9QTkDpiwuoRcIf%2Fimage.png?alt=media&#x26;token=8324de34-c749-4d52-8722-b74b9aea8d87" alt=""><figcaption></figcaption></figure>

## Delete&#x20;

* Navigate to the Utils folder for a normal DSL project.
* Select a utility file and open the ***Actions*** context menu for the selected file.
* Click the ***Delete*** option from the action context menu.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F670dWM5SWUXTNM6nK4Zr%2Fimage.png?alt=media&#x26;token=7debba25-41a8-40e3-9ee9-f87ea14cecd8" alt=""><figcaption></figcaption></figure>

* The ***Delete Utility*** dialog box appears to confirm the action.
* Click the ***Yes*** option.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FPA4tmroKCYj0lAeHh8xT%2Fimage.png?alt=media&#x26;token=98a1ee76-668d-428e-abb3-fcd4d9df0b8e" alt=""><figcaption></figcaption></figure>

* A notification appears to ensure that the selected Utility script is deleted. The utility script gets removed from the list.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FCARbvjAFv3qXGYXl2Zeb%2Fimage.png?alt=media&#x26;token=1100750a-7811-421e-baa7-0b24846d5819" alt=""><figcaption></figcaption></figure>

## Information

The information action option displays details for the Utility file whether it is imported from the Git of imported from the local system.

* Navigate to the Utils folder for a normal DSL project.
* Select a utility file and open the ***Actions*** context menu for the selected file.
* Click the ***Information*** option from the action context menu.
  * Description: The inserted description for the utility file while importing the file gets displayed for the utility files imported from the system.
  * Last updated & Description: The last updated date and description are displayed for the utility scripts imported from Git.

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2FO1naI2YcMDNyvSmxNEVN%2Fimage.png?alt=media&#x26;token=7a5d7579-e9aa-471a-84e0-62be9ef3b9ff" alt=""><figcaption><p><em><strong>Information context menu for an imported Utility file</strong></em></p></figcaption></figure>

<figure><img src="https://3817372244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fz33KQNYQvBTgQKJBgwTz%2Fuploads%2F5irPKCTN6lHn93yWLuX7%2Fimage.png?alt=media&#x26;token=e3af1019-e901-4e6b-9e83-7df96c7f8171" alt=""><figcaption><p><em><strong>Information context menu for a Utility file  pulled from GIt</strong></em></p></figcaption></figure>
