Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoyalRender: environment injection on the server #6160

Merged
merged 52 commits into from Apr 30, 2024

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Jan 24, 2024

Changelog Description

Previously env vars were injected directly on the client during submission. That could have issues when environment on client machines is different than on workers.

This PR tries similar approach as on DL when before job is rendered it queries Ayon to get environment variables for context.
These variables are used to create .rrEnv file and attach it to the job. That should provide rendering environment controlled by Ayon.

Additional info

It expects installed Ayon on worker machines with these env vars (for now):

  • AYON_SERVER_URL
  • AYON_API_KEY
  • AYON_EXECUTABLE_PATH - path to ayon_console on the worker(s) - should be parsed from renderApps config in the future

Expects redeployment of RR plugins from openpype/modules/royalrender/rr_root to RR_ROOT

This PR still uses old OP (because of customer environment), needs to be converted for ayon-core

Maybe AYON_BUNDLE_NAME should be used instead of Version if it would be possible to parse it out.
This should be added only to render jobs.
This should be added only to render jobs.
Was adding env vars from client not rendering worker. Limitation on 2k characters.
Stored to rrEnvList just to be saved to .json from where it is parsed. Hopefully there would be a way how to parse it directly from RR job and not reaching to .json
@kalisp kalisp requested a review from antirotor January 24, 2024 14:40
@ynbot
Copy link
Contributor

ynbot commented Jan 24, 2024

Task linked: OP-7687 Environments in RoyalRender

@kalisp kalisp self-assigned this Jan 24, 2024
@ynbot ynbot added type: enhancement Enhancements to existing functionality size/M Denotes a PR changes 500-999 lines, ignoring general files host: Maya host: Nuke module: RoyalRender RoyalRender related features labels Jan 24, 2024
@kalisp kalisp marked this pull request as ready for review January 30, 2024 11:03
@kalisp kalisp assigned antirotor and unassigned kalisp Jan 30, 2024
Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this isn't working in OP, we should not load it either. We need to add something like:

from openpype import AYON_SERVER_ENABLED
...
enabled = AYON_SERVER_ENABLED

or something similar

openpype/modules/royalrender/lib.py Show resolved Hide resolved
It seems that previous implementation is triggered too early and on submission machine.

Still bit WIP as `tcp.jobList_GetInfo` might not be available in Demo license. In that case this all will be unusable and should be scrapped.
…ncement/OP-7687_Environments-in-RoyalRender
…-in-RoyalRender' into enhancement/OP-7687_Environments-in-RoyalRender

# print("Set up server and login info")
tcp = rr._rrTCP("")
tcp.setServer(rrGlobal.rrServer(), 7773)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'rrGlobal'


def _is_required_environment(self):
if (not os.environ.get("AYON_API_KEY") or
not os.path.exists(os.environ.get("AYON_EXECUTABLE_PATH", ""))):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (80 > 79 characters)


modPath = rrGlobal.rrModPyrrPath()
sys.path.append(modPath)
import libpyRR39 as rr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module level import not at top of file

import uuid
import argparse

modPath = rrGlobal.rrModPyrrPath()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'rrGlobal'

@kalisp
Copy link
Member Author

kalisp commented Feb 8, 2024

Currently blocked as required methods from SDK are not available with Demo licenses.

kalisp and others added 3 commits February 9, 2024 11:56
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
@@ -3,6 +3,9 @@
import os
import openpype.modules
from openpype.modules import OpenPypeModule, IPluginPaths
from openpype import AYON_SERVER_ENABLED
from openpype.lib import Logger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'openpype.lib.Logger' imported but unused

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from openpype.lib import Logger

@kalisp kalisp marked this pull request as draft March 26, 2024 09:25
…ncement/OP-7687_Environments-in-RoyalRender
Cannot attach in pre load script later, only fill non-existent file.
Cannot figure out how to attach rrEnv file to existing job, submission already points to nonexistent file which gets filled by this cript.
…-in-RoyalRender' into enhancement/OP-7687_Environments-in-RoyalRender
import os
import sys
import json
import glob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'glob' imported but unused

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import glob

@kalisp kalisp marked this pull request as ready for review April 5, 2024 15:32
@kalisp kalisp requested a review from iLLiCiTiT April 8, 2024 09:23
@kalisp
Copy link
Member Author

kalisp commented Apr 9, 2024

This is currently implemented and (hopefully) working solution.

…yalrender_job.py

Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
@mkolar mkolar merged commit 4bb1959 into develop Apr 30, 2024
3 checks passed
@mkolar mkolar deleted the enhancement/OP-7687_Environments-in-RoyalRender branch April 30, 2024 14:17
@ynbot ynbot added this to the next-patch milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: Maya host: Nuke module: RoyalRender RoyalRender related features port to AYON size/M Denotes a PR changes 500-999 lines, ignoring general files sponsored Client endorsed or requested target: AYON type: enhancement Enhancements to existing functionality
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants