Hello,
this is pretty much identical to this post from some years ago:
I’m trying to do a headless Nuke publish on Deadline, and from what I can tell it’s all working fine except the published items don’t show up on any activity pages on the website. However If I go to the task’s version tab i see the mov that was successfully published. But I need it to also show up in the Activity tab.
this is my bootstrap code:
def bootstrap_sgtk(tk_app="tk-shell",
plugin_id="basic.shell"):
"""
Bootstrap the SGTK engine for a given project and tk-app
"""
# Bootstrap the engine
try:
sgtk.LogManager().initialize_custom_handler()
sgtk.LogManager().global_debug = True
# create script user
user = authenticate_script_user()
mgr = sgtk.bootstrap.ToolkitManager(sg_user=user)
mgr.plugin_id = plugin_id
project_entity = {"type": "Project", "id": SGTK_PROJECT_ID}
engine = mgr.bootstrap_engine(tk_app, entity=project_entity)
_logger.log(f"Successfully bootstrapped SGTK from: {SGTK_PROJECT}")
return engine
except Exception as e:
_logger.error(f"ERROR: Could not bootstrap SGTK: {e}")
sys.exit(1)
Here is part of the code I’m using to do the headless publish:
nuke.scriptOpen(nuke_work_file_path)
engine = bootstrap_sgtk(tk_app="tk-nuke")
tk = engine.sgtk
_logger.log(f"{engine.apps=}")
latest_work, highest_version = get_latest_work(tk=tk,
fields=fields)
fields["version"] = highest_version
task = get_task_entity(tk=tk,
shot_name=fields["Shot"],
task_name=fields["Task"])
_logger.log(f"{task=}")
if not task:
print("no task entity found")
return
_logger.log("changing context")
task_context = tk.context_from_entity("Task", task["id"])
engine.change_context(task_context)
_logger.log("context changed")
print_ctx_info(ctx=engine.context)
publish_app = engine.apps["tk-multi-publish2"]
writenode_app = engine.apps["tk-nuke-writenode"]
writenode_app.convert_from_write_nodes(show_warning=False)
nuke.scriptSave(nuke_work_file_path)
manager = publish_app.create_publish_manager()
manager.collect_session()
# Iterate through all descendants of all items to be published
for item in manager.tree.root_item.descendants:
for task in item.tasks:
task.enabled = True
_logger.log(f"TASK NAME = {task.name}")
manager.validate()
# check for validation errors
for item in manager.tree.root_item.children:
if item.properties.get("sg_publish_data"):
print(f"Item: {item.name}")
for task in item.tasks:
if not task.settings.get("valid", True):
print(f" Validation failed: {task.name}")
_logger.log("PUBLISHING")
manager.publish()
_logger.log("FINALIZING")
manager.finalize()
nuke.scriptSave(nuke_work_file_path)
_logger.log("Headless publish complete!")
The code completes without errors on Deadline.
the task.name that get printed are these three:
2025-11-21 05:32:34: 0: STDOUT: TASK NAME = Publish to Flow Production Tracking
2025-11-21 05:32:34: 0: STDOUT: TASK NAME = Publish to Flow Production Tracking
2025-11-21 05:32:34: 0: STDOUT: TASK NAME = Submit for Review
aand this is the tk-multi-publish2 nuke.shot_step setting:
# shot step
settings.tk-multi-publish2.nuke.shot_step:
collector: "{self}/collector.py:{config}/tk-multi-publish2/tk-nuke/basic/collector.py"
collector_settings:
Work Template: nuke_shot_work
publish_plugins:
- name: Publish to Flow Production Tracking
hook: "{self}/publish_file.py:{config}/tk-multi-publish2/tk-nuke/publish_file.py"
settings: {}
- name: Upload for review
hook: "{self}/upload_version.py"
settings: {}
- name: Begin file versioning
hook: "{engine}/tk-multi-publish2/basic/nuke_start_version_control.py"
settings: {}
- name: Publish to Flow Production Tracking
hook: "{self}/publish_file.py:{engine}/tk-multi-publish2/basic/nuke_publish_script.py"
settings:
Publish Template: nuke_shot_publish
- name: Submit for Review
hook: "{engine}/tk-multi-publish2/basic/submit_for_review.py"
settings: {}
post_phase: "{config}/tk-multi-publish2/tk-nuke/basic/post_phase.py"
help_url: *help_url
location: "@apps.tk-multi-publish2.location"
It’s also worth noting that a manual nuke publish from within the DCC works just fine and both publishes and creates the version on the activity pages.
Any help is appreciated, a bit stumped.
Thanks!