Create a refactor job to refactor the Spark or Airflow code in a Git repository for a
target version. The wizard asks for the repository, the code to refactor, and the AI settings,
and you confirm that you review the result before you use it.
Code Migrator is available. It is displayed when Enable LLM is on
in the engine configuration of the Cloudera Migration Assistant engine.
You have the URL of the Git repository and the branch or commit to start from. For a
private repository, you also have a username and an access token that can read the
repository.
You have the cma-migrator or cma-admin role.
In the navigation pane, click Code Migrator.
The Refactor page opens.
Click Create.
The Create Refactoring Job wizard opens on the Cluster & Git definition step.
Enter the repository:
For a repository in the built-in Git server, turn on Use local git
server, and then select the Repository.
For any other repository, enter its Repository URL. For a
private repository, expand Credentials (optional), and then enter
a Username and an Access Token.
In Reference, enter the branch name or commit hash to start
from.
Click Next.
The Workflows step opens.
In Workflow Type, select Airflow or
Spark.
Select the Source Version.
Select the Target Version.
The target versions in the list depend on the source version. You can also type a
version that is not in the list.
In Source Root Folder, enter the folder of the repository that
holds the code.
Enter / for the whole repository.
Optional: To refactor more code in the same repository, click Add Workflow,
and repeat steps 6 through 9 for the new workflow.
Click Next.
The AI Settings step opens. The alert This job uses AI
to change your code names the folder and repository that the job reads, the
target version, and the model.
In Migration mode, select Minimal or
Improve.
Optional: To make the agents remember earlier iterations and retries, turn on Agent
Memory.
To load less history, turn on Iteration Window or Message Limit, and enter a Cap.
Optional: In Additional context, enter instructions for the agents, for
example libraries to keep or conventions to follow.
Code Migrator searches the migration documentation of the target framework on its own
while it works. You do not need to ask for it in Additional
context.
Click Next.
The Review step opens.
Check the details of the job in Refactor Details.
In the AI use card, select the check box I understand
that an AI system will change this code, and that I need to review the changes before
they are merged.
Cloudera Migration Assistant saves your acknowledgment with the job.
Click Finalize Refactor Job.
Cloudera Migration Assistant creates one job for each workflow, and the Refactor
page opens. A new job is queued, and then runs. The Status column
displays its progress, and the Iterations column displays how many
times Code Migrator has refactored the code so far.
To follow a job, click it. The Agent Activity panel displays what the
agents do in each iteration.
When the job ends, review its output. See Reviewing output on Git branches.