-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add internal CLI to generate instance descriptions for CSPs (#1137)
* refactored code for adding new cli to generate instance description files for csps Signed-off-by: cindyyuanjiang <[email protected]> * fixed python style Signed-off-by: cindyyuanjiang <[email protected]> * addressed review feedback Signed-off-by: cindyyuanjiang <[email protected]> * fix python style Signed-off-by: cindyyuanjiang <[email protected]> * function return type Signed-off-by: cindyyuanjiang <[email protected]> * simplified instance description json structure Signed-off-by: cindyyuanjiang <[email protected]> * update json key to VCpuCount Signed-off-by: cindyyuanjiang <[email protected]> * fixed case when user give non-exist output folder Signed-off-by: cindyyuanjiang <[email protected]> * add gpu info for n1 series dataproc Signed-off-by: cindyyuanjiang <[email protected]> * fixed python style Signed-off-by: cindyyuanjiang <[email protected]> * cleaned up comments Signed-off-by: cindyyuanjiang <[email protected]> * fix issue with databricks azure platform input Signed-off-by: cindyyuanjiang <[email protected]> * update gpu count to list for consistency Signed-off-by: cindyyuanjiang <[email protected]> * updated comment for gpu count to list Signed-off-by: cindyyuanjiang <[email protected]> --------- Signed-off-by: cindyyuanjiang <[email protected]>
- Loading branch information
1 parent
235f048
commit c580851
Showing
11 changed files
with
315 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
user_tools/src/spark_rapids_pytools/rapids/dev/instance_description.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Implementation class representing wrapper around the RAPIDS acceleration Prediction tool.""" | ||
|
||
import os | ||
from dataclasses import dataclass | ||
|
||
from spark_rapids_pytools.rapids.rapids_tool import RapidsTool | ||
from spark_rapids_pytools.common.sys_storage import FSUtil | ||
from spark_rapids_pytools.common.utilities import Utils | ||
from spark_rapids_pytools.cloud_api.sp_types import get_platform | ||
from spark_rapids_pytools.rapids.tool_ctxt import ToolContext | ||
|
||
|
||
@dataclass | ||
class InstanceDescription(RapidsTool): | ||
"""Wrapper layer around Generate_Instance_Description Tool.""" | ||
|
||
name = 'instance_description' | ||
instance_file = '' # local absolute path of the instance description file | ||
|
||
def _connect_to_execution_cluster(self) -> None: | ||
pass | ||
|
||
def _collect_result(self) -> None: | ||
pass | ||
|
||
def _archive_phase(self) -> None: | ||
pass | ||
|
||
def _init_ctxt(self) -> None: | ||
""" | ||
Initialize the tool context, reusing qualification configurations. | ||
""" | ||
self.config_path = Utils.resource_path('qualification-conf.yaml') | ||
self.ctxt = ToolContext(platform_cls=get_platform(self.platform_type), | ||
platform_opts=self.wrapper_options.get('platformOpts'), | ||
prop_arg=self.config_path, | ||
name=self.name) | ||
|
||
def _process_output_args(self) -> None: | ||
self.logger.debug('Processing Output Arguments') | ||
if self.output_folder is None: | ||
self.output_folder = Utils.get_rapids_tools_env('OUTPUT_DIRECTORY', os.getcwd()) | ||
# make sure that output_folder is being absolute | ||
self.output_folder = FSUtil.get_abs_path(self.output_folder) | ||
FSUtil.make_dirs(self.output_folder) | ||
self.instance_file = f'{self.output_folder}/{self.platform_type}-instance-catalog.json' | ||
self.logger.debug('Instance description output will be saved in: %s', self.instance_file) | ||
|
||
def _run_rapids_tool(self) -> None: | ||
self.ctxt.platform.cli.generate_instance_description(self.instance_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.