Skip to content

Commit 3942dc5

Browse files
eantoninfrancesco-giordano
authored andcommitted
Add logs to better identify the timing of the different phases of create-cluster calls
Signed-off-by: Edoardo Antonini <[email protected]>
1 parent 3472a87 commit 3942dc5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cli/src/pcluster/models/cluster.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,23 @@ def create(
359359
validator_suppressors, validation_failure_level
360360
)
361361

362+
LOGGER.info("Generating artifact dir and uploading config...")
362363
self._add_tags()
363364
self._generate_artifact_dir()
364365
artifact_dir_generated = True
365366
self._upload_config()
367+
LOGGER.info("Generation and upload completed successfully")
366368

367369
# Create template if not provided by the user
368370
if not (self.config.dev_settings and self.config.dev_settings.cluster_template):
369-
LOGGER.info("Generating CDK template...")
370371
self.template_body = CDKTemplateBuilder().build_cluster_template(
371372
cluster_config=self.config, bucket=self.bucket, stack_name=self.stack_name
372373
)
373-
LOGGER.info("CDK template generated correctly.")
374374

375+
LOGGER.info("Uploading cluster artifacts...")
375376
# upload cluster artifacts and generated template
376377
self._upload_artifacts()
378+
LOGGER.info("Upload of cluster artifacts completed successfully")
377379

378380
LOGGER.info("Creating stack named: %s", self.stack_name)
379381
creation_result = AWSApi.instance().cfn.create_stack_from_url(

cli/src/pcluster/templates/cdk_builder.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
99
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
1010
# limitations under the License.
11-
1211
#
1312
# This module contains all the classes required to convert a Cluster into a CFN template by using CDK.
1413
#
14+
15+
import logging
1516
import os
1617
import tempfile
1718

@@ -20,6 +21,8 @@
2021
from pcluster.models.s3_bucket import S3Bucket
2122
from pcluster.utils import load_yaml_dict
2223

24+
LOGGER = logging.getLogger(__name__)
25+
2326

2427
class CDKTemplateBuilder:
2528
"""Create the template, starting from the given resources."""
@@ -29,16 +32,20 @@ def build_cluster_template(
2932
cluster_config: BaseClusterConfig, bucket: S3Bucket, stack_name: str, log_group_name: str = None
3033
):
3134
"""Build template for the given cluster and return as output in Yaml format."""
35+
LOGGER.info("Importing CDK...")
3236
from aws_cdk.core import App # pylint: disable=C0415
3337

3438
from pcluster.templates.cluster_stack import ClusterCdkStack # pylint: disable=C0415
3539

40+
LOGGER.info("CDK import completed successfully")
41+
LOGGER.info("Starting CDK template generation...")
3642
with tempfile.TemporaryDirectory() as tempdir:
3743
output_file = str(stack_name)
3844
app = App(outdir=str(tempdir))
3945
ClusterCdkStack(app, output_file, stack_name, cluster_config, bucket, log_group_name)
4046
app.synth()
4147
generated_template = load_yaml_dict(os.path.join(tempdir, f"{output_file}.template.json"))
48+
LOGGER.info("CDK template generation completed successfully")
4249

4350
return generated_template
4451

0 commit comments

Comments
 (0)