Skip to content

Commit

Permalink
Merge pull request #118 from 4urcloud/dev-adrien-correct-Azure
Browse files Browse the repository at this point in the history
fix mljobs
  • Loading branch information
aeppling authored Jan 18, 2024
2 parents cf9436a + bda10c6 commit bcfe35d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
32 changes: 16 additions & 16 deletions Kexa/services/addOn/azureGathering.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ interface FunctionMap {
const customGatherFunctions: FunctionMap = {

'KexaAzure.vm': async (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");

try {
const computeClient = new ComputeManagementClient(credential, subscriptionId);
Expand All @@ -1957,7 +1957,7 @@ const customGatherFunctions: FunctionMap = {
},

'KexaAzure.mlWorkspaces': async (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");

try {
const mlClient = new AzureMachineLearningWorkspaces(credential, subscriptionId);
Expand All @@ -1969,7 +1969,7 @@ const customGatherFunctions: FunctionMap = {
},

'KexaAzure.mlJobs': async (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");

try {
const mlClient = new AzureMachineLearningWorkspaces(credential, subscriptionId);
Expand All @@ -1982,7 +1982,7 @@ const customGatherFunctions: FunctionMap = {
},

'KexaAzure.mlComputes': async (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");

try {
const mlClient = new AzureMachineLearningWorkspaces(credential, subscriptionId);
Expand All @@ -1995,7 +1995,7 @@ const customGatherFunctions: FunctionMap = {
},

'KexaAzure.mlSchedules': async (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");
try {
const mlClient = new AzureMachineLearningWorkspaces(credential, subscriptionId);
let workspaces = await workspacesListing(mlClient);
Expand All @@ -2007,12 +2007,12 @@ const customGatherFunctions: FunctionMap = {
},

'KexaAzure.storage': (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");
return [];
},

'KexaAzure.blob': (name: string, credential: any, subscriptionId: any) => {
console.log("Starting " + name + " listing...");
logger.info("Starting " + name + " listing...");
//listAllBlob();
return [];
},
Expand Down Expand Up @@ -2046,7 +2046,7 @@ export async function virtualMachinesListing(client:ComputeManagementClient, mon
vm.instanceView.availableMemoryBytes = convertMinMaxMeanMedianToPercentage(vm.instanceView.availableMemoryBytes, convertGbToBytes(vm.details?.MemoryGb??0));
resultList.push(vm);
}
return resultList;
return resultList ?? null;
}catch (err) {
logger.debug("error in virtualMachinesListing:"+err);
return null;
Expand Down Expand Up @@ -2131,7 +2131,7 @@ async function listAllBlob(client:StorageManagementClient, credentials: any): Pr
}
}
}
return resultList;
return resultList ?? null;
} catch (err) {
logger.debug("error in resourceGroupListing:"+err);
return null;
Expand All @@ -2146,7 +2146,7 @@ async function workspacesListing(mlClient: AzureMachineLearningWorkspaces): Prom
for await (let item of mlClient.workspaces.listBySubscription()) {
workspacesResult = [...workspacesResult??[], item];
}
return workspacesResult;
return workspacesResult ?? null;
}

async function jobsListing(client: AzureMachineLearningWorkspaces, workspaces: Array<Workspace>): Promise<any> {
Expand All @@ -2161,10 +2161,10 @@ async function jobsListing(client: AzureMachineLearningWorkspaces, workspaces: A
result.resourceGroupName = resourceGroupName;
resArray.push(result);
}
return resArray;
return resArray ?? null;
} catch(e){
logger.debug("error in jobsListing:"+e);
return [];
return null;
}
}
}
Expand All @@ -2181,10 +2181,10 @@ async function computeOperationsListing(client: AzureMachineLearningWorkspaces,
result.resourceGroupName = resourceGroupName;
resArray.push(item);
}
return resArray;
return resArray ?? null;
}catch(e){
logger.debug("error in computeOperationsListing:"+e);
return [];
return null;
}
}
}
Expand All @@ -2201,10 +2201,10 @@ async function schedulesListing(client: AzureMachineLearningWorkspaces, workspac
result.resourceGroupName = resourceGroupName;
resArray.push(item);
}
return resArray;
return resArray ?? null;
} catch(e){
logger.debug("error in schedulesListing:"+e);
return [];
return null;
}
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"typescript": "^4.9.5"
},
"name": "Kexa",
"version": "1.12.0-SNAPSHOT.27.b972da9",
"version": "1.12.0-SNAPSHOT.27.b972da9\r",
"main": "./build/index.js",
"scripts": {
"postinstall": "node-config-ts",
Expand Down

0 comments on commit bcfe35d

Please sign in to comment.