Fix task running in Google Colab does not fetch the notebook diff appropriately (#1204)

This commit is contained in:
allegroai 2024-03-17 14:59:35 +02:00
parent b7c5ec9538
commit 57614e68a5
2 changed files with 9 additions and 6 deletions

View File

@ -610,9 +610,15 @@ class ScriptInfo(object):
except Exception: except Exception:
pass pass
if not (sys.argv[0].endswith(os.path.sep + 'ipykernel_launcher.py') or if (
sys.argv[0].endswith(os.path.join(os.path.sep, 'ipykernel', '__main__.py'))) \ not (
or len(sys.argv) < 3 or not sys.argv[2].endswith('.json'): sys.argv[0].endswith(os.path.sep + "ipykernel_launcher.py")
or sys.argv[0].endswith(os.path.join(os.path.sep, "ipykernel", "__main__.py"))
or sys.argv[0].endswith(os.path.sep + "colab_kernel_launcher.py")
)
or len(sys.argv) < 3
or not sys.argv[2].endswith(".json")
):
return None return None
# we can safely assume that we can import the notebook package here # we can safely assume that we can import the notebook package here

View File

@ -282,9 +282,6 @@
"new_task.update_parameters({\"General/max_depth\": 3})\n", "new_task.update_parameters({\"General/max_depth\": 3})\n",
"# We can even rename it if we wanted\n", "# We can even rename it if we wanted\n",
"new_task.rename(f\"Cloned Task\")\n", "new_task.rename(f\"Cloned Task\")\n",
"# Make sure that the diff does not contain Colab invocation!\n",
"# cf. https://github.com/allegroai/clearml/issues/1204\n",
"new_task.set_script(diff=\"pass\")\n",
"# Now enqueue it for the colab worker to start working on it!\n", "# Now enqueue it for the colab worker to start working on it!\n",
"Task.enqueue(task=new_task, queue_name=\"default\")" "Task.enqueue(task=new_task, queue_name=\"default\")"
] ]