Snowpark Migration Accelerator: SMA 실행 가이드¶
PySpark 입력¶
SMA- Checkpoints 기능은 PySpark DataFrames 사용을 감지하는지에 좌우되므로 PySpark 워크로드가 진입점으로 필요합니다. 이 연습은 단일 Python 스크립트를 사용하여 이 기능을 안내하고, 일반적인 PySpark 워크플로 내에서 검사점을 생성하고 활용하는 방법에 대한 간단한 예를 제공합니다.
입력 워크로드

Sample.py 파일 내용
from pyspark.sql import SparkSession
from pyspark.sql import functions as F
spark = SparkSession.builder.appName("SparkFunctionsExample2").getOrCreate()
df1 = spark.createDataFrame([("Alice", "NY"), ("Bob", "LA")], ["name", "city"])
df2 = spark.createDataFrame([(10,), (20,)], ["number"])
df1_with_index = df1.withColumn("index", F.monotonically_increasing_id())
df2_with_index = df2.withColumn("index", F.monotonically_increasing_id())
df3 = df1_with_index.join(df2_with_index, on="index").drop("index")
df3.show()
워크로드 마이그레이션¶
기능 활성화¶
SMA-Checkpoints 기능이 활성화되어 있는 경우 checkpoints.json 파일이 생성됩니다. 이 기능이 비활성화되어 있는 경우 이 파일이 입력 또는 출력 폴더에 생성되지 않습니다. 기능의 활성화 여부와 관계없이 DataFramesInventory.csv 및 CheckpointsInventory.csv 인벤토리 파일은 항상 생성됩니다. 이 파일은 분석 및 디버깅에 필수적인 메타데이터를 제공합니다.
변환 프로세스¶
자체 프로젝트를 변환하려면 SMA 사용자 가이드를 따르세요.
SMA-Checkpoints 기능 설정¶
변환 프로세스 중에 변환 설정을 사용자 지정할 수 있습니다. SMA-Checkpoints 기능 설정을 확인하세요.
참고: 이 사용자 가이드에서는 기본 변환 설정을 사용했습니다.
변환 결과¶
마이그레이션 프로세스가 완료되면 SMA-Checkpoints 기능은 두 개의 새 인벤토리 파일을 생성하고 checkpoints.json 파일을 입력 및 출력 폴더 모두에 추가합니다.
관련 인벤토리를 검토하려면 SMA-Checkpoints 인벤토리를 참조하세요.
입력 폴더¶

checkpoints.json 파일 내용
{
"createdBy": "Snowpark Migration Accelerator",
"comment": "This file was automatically generated by the SMA tool as checkpoints collection was enabled in the tool settings. This file may also be modified or deleted during SMA execution.",
"type": "Collection",
"pipelines": [
{
"entryPoint": "sample.py",
"checkpoints": [
{
"name": "sample$BBVOC7$df1$1",
"file": "sample.py",
"df": "df1",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
},
{
"name": "sample$BBVOC7$df2$1",
"file": "sample.py",
"df": "df2",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
},
{
"name": "sample$BBVOC7$df3$1",
"file": "sample.py",
"df": "df3",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
}
]
}
]
}
출력 폴더¶

checkpoints.json 파일 내용
{
"createdBy": "Snowpark Migration Accelerator",
"comment": "This file was automatically generated by the SMA tool as checkpoints collection was enabled in the tool settings. This file may also be modified or deleted during SMA execution.",
"type": "Validation",
"pipelines": [
{
"entryPoint": "sample.py",
"checkpoints": [
{
"name": "sample$BBVOC7$df1$1",
"file": "sample.py",
"df": "df1",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
},
{
"name": "sample$BBVOC7$df2$1",
"file": "sample.py",
"df": "df2",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
},
{
"name": "sample$BBVOC7$df3$1",
"file": "sample.py",
"df": "df3",
"location": 1,
"enabled": true,
"mode": 1,
"sample": "1.0"
}
]
}
]
}
SMA 실행 흐름이 완료되고 입력 및 출력 폴더 모두에 각각의 checkpoints.json 파일이 있으면 Snowpark-Checkpoints 실행 프로세스를 시작할 준비가 된 것입니다.