Skip to content

Commit

Permalink
Changed deployed templates path
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanch3z_Sama committed Jul 22, 2024
1 parent c6aa461 commit 26eb014
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 156 deletions.
20 changes: 2 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
# apricot

[![Github Actions Status](https://github.com/AntonioSanch3z/apricotLab/workflows/Build/badge.svg)](https://github.com/AntonioSanch3z/apricotLab/actions/workflows/build.yml)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/AntonioSanch3z/apricotLab/main?urlpath=lab)
[![Github Actions Status](https://github.com/grycap/apricotlab/workflows/Build/badge.svg)](https://github.com/grycap/apricotlab/actions/workflows/build.yml)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/grycap/apricotlab/main?urlpath=lab)
Advanced Platform for Reproducible Infrastructure in the Cloud via Open Tools.

## Requirements

- JupyterLab >= 4.0.0

## Install

To install the extension, execute:

```bash
pip install apricot
```

## Uninstall

To remove the extension, execute:

```bash
pip uninstall apricot
```

## Contributing

### Development install
Expand Down
149 changes: 16 additions & 133 deletions src/apricot-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"#### Welcome to the APRICOT extension. This plugin designed for Jupyter Notebooks allows you to deploy and manage virtual infrastructures using the Infrastructure Manager. In this notebook, we will cover the basics to help you get started with APRICOT.\n",
"\n",
"First of all, let's create create a simple infrastructure to execute the following example notebook. To do so, click in the **Infrastructure deployment** button in the toolbar above and follow the steps to deploy your first infrastructure. Any infrastructure should be able to execute all commands.\n",
"First of all, let's create create a simple infrastructure to execute the following example notebook. To do so, click in the **Deployment menu** button in the toolbar above and follow the steps to deploy your first infrastructure. Any infrastructure should be able to execute all commands.\n",
"\n",
"Once the infrastructure has been deployed, we can start playing with the notebook."
]
Expand Down Expand Up @@ -38,21 +38,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+------------+--------------------------------------+---------------+------------+\n",
"| Name | Infrastructure ID | IP | State |\n",
"+============+======================================+===============+============+\n",
"| infra-name | f32cf700-353f-11ef-8d60-e687f511a619 | 158.42.104.51 | configured |\n",
"+------------+--------------------------------------+---------------+------------+\n"
]
}
],
"outputs": [],
"source": [
"%apricot_ls"
]
Expand Down Expand Up @@ -83,21 +71,9 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+---------+---------------+------------+------------+------------------------------+\n",
"| VM ID | IP Address | Status | Provider | OS Image |\n",
"+=========+===============+============+============+==============================+\n",
"| 0 | 158.42.104.51 | configured | OpenNebula | one://ramses.i3m.upv.es/1593 |\n",
"+---------+---------------+------------+------------+------------------------------+\n"
]
}
],
"outputs": [],
"source": [
"%apricot_vmls $infrastructure_id"
]
Expand All @@ -111,27 +87,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"text/plain": [
"'Done'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%apricot exec $infrastructure_id $vm_id touch \"test123.txt\""
]
Expand All @@ -145,30 +103,9 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"one-context_6.2.0-1.deb\n",
"snap\n",
"test123.txt\n",
"\n"
]
},
{
"data": {
"text/plain": [
"'Done'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%apricot exec $infrastructure_id $vm_id ls"
]
Expand All @@ -182,51 +119,18 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"text/plain": [
"'Done'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%apricot_download $infrastructure_id $vm_id test123.txt ."
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"__pycache__\n",
"apricot-tutorial.ipynb\n",
"apricot_magics.py\n",
"buttons.ts\n",
"deploymentMenu.ts\n",
"index.ts\n",
"listDeployments.ts\n",
"test123.txt\n"
]
}
],
"outputs": [],
"source": [
"%%bash\n",
"ls"
Expand All @@ -241,30 +145,9 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Destroying...\n",
"Secure connection with: https://im.egi.eu/im \n",
"Infrastructure successfully destroyed\n",
"\n"
]
},
{
"data": {
"text/plain": [
"'Done'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"%apricot destroy $infrastructure_id"
]
Expand Down Expand Up @@ -293,7 +176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
6 changes: 2 additions & 4 deletions src/deploymentMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,13 @@ async function createImagesDropdown(

// Check if the output contains "error" in the message
if (output.toLowerCase().includes('error')) {
// If "error" is found, trigger an alert with the output
alert(output);
}

// Find the first occurrence of '[' and get the substring from there
const jsonStartIndex = output.indexOf('[');
if (jsonStartIndex === -1) {
console.error('No os images available.');
console.error('No OS images available.');
return;
}

Expand Down Expand Up @@ -512,8 +511,7 @@ const getEGIToken = async () => {
function deployIMCommand(obj: IDeployInfo, mergedTemplate: string): string {
const pipeAuth = `${obj.infName}-auth-pipe`;
const imageRADL = obj.infName;
const templatePath = `~/.imclient/templates/${imageRADL}.yaml`;

const templatePath = `$PWD/deployed-templates/${imageRADL}.yaml`;
let cmd = `%%bash
PWD=$(pwd)
# Remove pipes if they exist
Expand Down
4 changes: 3 additions & 1 deletion src/listDeployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function populateTable(table: HTMLTableElement): Promise<void> {
const kernel = await kernelManager.startNew();

try {
// Use a bash command to read the contents of infrastructuresList.json
// Read the contents of infrastructuresList.json
const cmdReadJson = '%%bash\n' + 'cat $PWD/infrastructuresList.json';

const futureReadJson = kernel.requestExecute({ code: cmdReadJson });
Expand Down Expand Up @@ -200,6 +200,7 @@ function infrastructureState(infrastructure: IInfrastructure): string {
vo = '',
EGIToken = ''
} = infrastructure;

const pipeAuth = 'auth-pipe';

let authContent = `id=im; type=InfrastructureManager; username=${IMuser}; password=${IMpass};\n`;
Expand Down Expand Up @@ -262,6 +263,7 @@ function infrastructureIP(infrastructure: IInfrastructure): string {
vo = '',
EGIToken = ''
} = infrastructure;

const pipeAuth = 'auth-pipe';

let authContent = `id=im; type=InfrastructureManager; username=${IMuser}; password=${IMpass};\n`;
Expand Down

0 comments on commit 26eb014

Please sign in to comment.