OP-1920 - added syncserver command

This commit is contained in:
Petr Kalis 2021-10-25 16:55:11 +02:00
parent 421ac7716e
commit 02b78dc7f8
2 changed files with 12 additions and 6 deletions

View file

@ -305,9 +305,7 @@ def runtests(folder, mark, pyargs):
is_flag=True, help=("Run process in debug mode"))
@click.option("-a", "--active_site", required=True,
help="Name of active stie")
@click.option("-r", "--remote_site", required=True,
help="Name of remote site")
def syncsiteserver(debug, active_site, remote_site):
def syncserver(debug, active_site):
"""Run sync site server in background.
Some Site Sync use cases need to expose site to another one.
@ -316,7 +314,12 @@ def syncsiteserver(debug, active_site, remote_site):
to SFTP for only a couple of artists, some background process must
mark published assets to live on multiple sites (they might be
physically in same location - mounted shared disk).
Process mimics OP Tray with specific 'active_site' name, all
configuration for this "dummy" user comes from Setting or Local
Settings (configured by starting OP Tray with env
var SITE_SYNC_LOCAL_ID set to 'active_site'.
"""
if debug:
os.environ['OPENPYPE_DEBUG'] = '3'
PypeCommands().syncsiteserver(active_site, remote_site)
PypeCommands().syncserver(active_site)

View file

@ -285,13 +285,16 @@ class PypeCommands:
print("Running {}".format(cmd))
subprocess.run(cmd)
def syncsiteserver(self, active_site, remote_site):
def syncserver(self, active_site):
"""Start running sync_server in background."""
os.environ["SITE_SYNC_LOCAL_ID"] = active_site
from openpype.modules import ModulesManager
manager = ModulesManager()
sync_server_module = manager.modules_by_name["sync_server"]
sync_server_module.init_server()
sync_server_module.server_init()
sync_server_module.start_server()
import time