🔄aidp-resume-migration
- ソース
- GitHub で見る ↗
説明
中断されたマイグレーションを再開します。 マイグレーターは既に移行済みのノートブックをキャッシュ(インメモリおよびクラスター上)しているため、以降の実行ではそれらをスキップします。 次のような場合に使用: - 以前の `aidp-migrate-job` の実行が途中で強制終了された場合(Ctrl-C、クラスターの再起動、ネットワーク切断など) - 特定の依存ノートブックに対して手動修正を行った後、処理を再開する場合
原文を表示
Resume an interrupted migration. The migrator caches already-migrated notebooks (in-memory + on-cluster) so subsequent runs skip them. Use when a prior aidp-migrate-job run was killed mid-flight (Ctrl-C, cluster restart, network drop) or when resuming after a manual fix to a specific dep notebook.
ユースケース
- ✓中断されたマイグレーションを再開するとき
- ✓強制終了された処理を再実行するとき
- ✓ノートブック修正後に処理を再開するとき
本文(日本語訳)
aidp-resume-migration — 中断した移行作業の再開
このマイグレーターは再開可能な設計になっています。Pass-1 の dep 移行が成功するたびに、結果が2箇所にキャッシュされます:
job_migrate.py内のモジュールレベル_migration_cachedict(インメモリ、実行単位)- 出力パスに対するクラスター上の
os.path.exists()プローブ(実行をまたいで永続)
Pass-2 のタスク Notebook も同様に、最終的な .ipynb が <output-base>/<job>/notebooks/... に既に存在する場合はスキップされます。
次のような場合に使用
- 以前の
aidp-migrate-job実行が強制終了された場合(Ctrl-C、クラスター再起動、ネットワーク切断、タイムアウト) - ユーザーが特定の dep / タスク Notebook を手動編集しており、残りを再実行せずに再開したい場合
- ユーザーがマニフェストに新しいタスクを追加し、その新しいタスクのみ移行したい場合
デフォルト動作(再開は自動)
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--cluster <CLUSTER_ID> \
--aidp-base <AIDP_BASE> \
--datalake-ocid <DATALAKE_OCID> \
--workspace-id <WORKSPACE_UUID> \
--output-base <output-workspace-path> \
--oci-profile <profile>
デフォルトフラグは --skip-migrated(ON)です。出力パスに既に存在する Notebook はすべて自動的にスキップされます。
そのため、クラッシュ後に単純に再実行するだけで再開となります — 特別なフラグは不要です。
特定のタスクから再開する
失敗がタスク固有のものであり、そのタスクから開始したい場合(それ以前のタスクをすべてスキップ):
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--start-task <substring_of_task_key>
# + その他の標準引数
--start-task は task_key に対する部分文字列マッチです。マッチしたタスクよりもソート順が前になるタスクをすべてスキップします。
単一タスクのみ再開する(それ以外をすべてスキップ)
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--only-tasks "<task_key_1>,<task_key_2>"
# + その他
特定の dep を手動修正した後、その dep を使用するタスクだけを再実行したい場合に便利です。
既に移行済みの Notebook を強制的に再移行する
通常は 推奨しません — Claude のトークンを消費します。それでも必要な場合:
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--no-skip-migrated
# + その他
警告: このフラグは、出力パスにある移行済み .ipynb に対してユーザーが加えた手動編集を上書きします。
ユーザーが手動修正を行っている場合は、「はい、編集内容を上書きしてください」という明示的な確認なしに このフラグの使用を拒否してください。
キャッシュが誤った状態になるケース
以下のシナリオではキャッシュが不正確になることがあります — 該当する場合は手動でクリアしてください:
| シナリオ | 対処方法 |
|---|---|
| ユーザーが前回の移行後にソースの Databricks Notebook を編集した。マイグレーターは出力が既に存在するためスキップしてしまう。 | AIDP ワークスペースから対応する出力 .ipynb を削除し、再実行する。 |
| ユーザーがマニフェストを変更して新しい dep を追加したが、以前に移行済みのタスクが古い dep パスを参照したままになっている。 | そのタスクの出力 .ipynb を削除し、再実行する。 |
出力 .ipynb が作成されたが、空または破損している(クラスターが書き込み中に停止した場合)。 |
破損したファイルを削除し、再実行する。 |
--clear-cache フラグは存在しません — キャッシュとは <output-base> のファイルシステム状態そのものです。
再開時のクラスター状態
実行前に、クラスターがまだ Active 状態であることを確認してください(アイドル自動停止している可能性があります):
# (bootstrap スキルのチェックを使用)
Stopped 状態の場合は、AIDP コンソールから起動してください。
再開後の最初のセルは接続セットアップのコスト(約 10〜30 秒)がかかりますが、その後は通常の処理速度に戻ります。
完了済みの内容を確認する方法
# このジョブの移行済み Notebook を一覧表示
oci os object list ... (または AIDP ワークスペースの一覧機能を使用)
ls reports/<job-name>/notebooks/ # 正常実行後のローカルミラー
または、ログをリアルタイムで確認し、再開時に表示される [SKIP] already migrated: の行を探してください。
この後の作業
aidp-migrate-jobと同様です —JOB_REPORT.mdを確認し、失敗したセルをaidp-fixup-cellにルーティングするなど、通常の後処理を行ってください。
原文(English)を表示
aidp-resume-migration — pick up where you left off
The migrator is designed to be resumable. Each successful Pass-1 dep migration is cached in two places:
- Module-level
_migration_cachedict injob_migrate.py(in-memory, per-run). - On-cluster
os.path.exists()probe against the output path (persistent across runs).
Pass-2 task notebooks are similarly skipped if their final .ipynb already exists at <output-base>/<job>/notebooks/....
When to use
- A prior
aidp-migrate-jobrun was killed (Ctrl-C, cluster restart, network drop, timeout). - The user manually edited a specific dep / task notebook and wants to resume without re-doing the rest.
- The user added a new task to the manifest and wants to migrate only the new task.
Default behavior (resume is automatic)
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--cluster <CLUSTER_ID> \
--aidp-base <AIDP_BASE> \
--datalake-ocid <DATALAKE_OCID> \
--workspace-id <WORKSPACE_UUID> \
--output-base <output-workspace-path> \
--oci-profile <profile>
The default flag is --skip-migrated (ON). Every notebook already at the output path is silently skipped. So a plain re-invoke after a crash IS the resume — no special flag needed.
Resuming from a specific task
If the failure was task-specific and you want to start there (skipping all earlier tasks):
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--start-task <substring_of_task_key>
# + the rest of the standard args
--start-task is a substring match on task_key. Skip every task whose key sorts before the matched task.
Resuming a single task (skip everything else)
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--only-tasks "<task_key_1>,<task_key_2>"
# + the rest
Useful when you've manually fixed one dep and want to re-run only the tasks that consume it.
Force re-migration of an already-migrated notebook
You typically DON'T want this — it burns Claude tokens. But if you must:
python3 ${CLAUDE_PLUGIN_ROOT}/engine/scripts/job_migrate.py \
--manifest reports/<MyJob>_manifest.json \
--no-skip-migrated
# + the rest
Warning: this overwrites any manual edits the user applied to the previously-migrated .ipynb at the output path. If the user has made manual fixes, REFUSE to use this flag without explicit "yes, overwrite my edits".
When the cache lies
The cache can be wrong in these scenarios — clear it manually if you see them:
| Scenario | Fix |
|---|---|
| User edited the SOURCE Databricks notebook after the prior migration. The migrator still skips it (output already exists). | Delete the corresponding output .ipynb from AIDP workspace + re-run. |
| User modified the manifest to add a new dep, but a previously-migrated task still uses the OLD dep path. | Delete the output .ipynb for that task + re-run. |
The output .ipynb was created but is empty / corrupt (cluster died mid-write). |
Delete the bad file + re-run. |
There's no --clear-cache flag — the cache IS the filesystem state of <output-base>.
Cluster state when resuming
Before invoking, verify the cluster is still Active (might have been auto-stopped for idle):
# (use the bootstrap skill's check)
If Stopped, start it via AIDP console. The first cell after resume will pay a connection-setup cost (~10-30s), then steady-state resumes.
How to know what's already done
# List all migrated notebooks for this job
oci os object list ... (or use AIDP workspace listing)
ls reports/<job-name>/notebooks/ # local mirror after a successful run
Or just tail the log and look for [SKIP] already migrated: lines on resume.
After this
- Same as
aidp-migrate-job— readJOB_REPORT.md, route failed cells toaidp-fixup-cell, etc.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。