Hi,
I’m trying to understand the Shotgun Event Daemon. I’m trying to test by running in the foreground however when I do I get two errors and then it will sit there as if it’s waiting for an input but nothing gets logged. The two errors I’m getting are:
timeout: timed out
Logged from file shotgunEventDaemon.py, line 856
CRITICAL:engine:Error running register callback function from plugin at /mnt/prod/pipeline/dev/mitch/git/shotgunEvents/src/plugins/logArgs.py.
Traceback (most recent call last):
File "/mnt/prod/pipeline/dev/mitch/git/shotgunEvents/src/shotgunEventDaemon.py", line 851, in load
regFunc(Registrar(self))
File "/mnt/prod/pipeline/dev/mitch/git/shotgunEvents/src/plugins/logArgs.py", line 42, in registerCallbacks
os.environ["SGDAEMON_LOGARGS_NAME"],
File "/usr/lib64/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'SGDAEMON_LOGARGS_NAME'
Any help would be appreciated!
Thanks,
Mitchell
The plugin you are testing with expects SGDAEMON_LOGARGS_NAME
to be an environment variable, set before starting the daemon. This is specific to the plugin.
@MitchWoodin
Each plugin needs to authenticate to be able to interact with ShotGrid. For the event plugins you need to create a new Script entity which provides you with a username and password. The plugin then uses these username and pass to basically login.
you could put the name and pass in the code like this:
reg.registerCallback(
"<SCRIPT-NAME>",
"<SCRIPT-PASSWORD>",
logArgs,
eventFilter,
None,
)
or you could assign these values as an environment variable to SGDAEMON_LOGARGS_NAME
and SGDAEMON_LOGARGS_KEY
and the code will pick them up during the execution. I would recommend this way which it’s safer.
You don’t have to create a new script name and key for each plugin and plugins can share them, but depending on the numbers of the plugins you’re going to have in your production, it might be a good practice to have a unique script name and key for each plugin, for the organization purposes.
Hope that helps
2 Likes
Where should I be getting that data from? Where does the script password come from? I’m assuming if the file is “logArgs.py” that <SCRIPT_NAME>
would be "logArgs"
but what about the password where am I supposed to find that?
@MitchWoodin
As mentioned, you’d need to create a new script key.
-
Click on your profile icon on top-right then select the Scripts
from the drop down menu:
-
From the Scripts page, click on Add Script
-
Ass you can see from the form, you can give a any name you want, that’ll be your SGDAEMON_LOGARGS_NAME
and the “Application Key” will be your SGDAEMON_LOGARGS_KEY
-
Click on the Copy to Clipboard
button and paste the value in your plugin python script or set to your environment variable, as I mentioned above.
I hope that helps
1 Like
That makes total sense and I’ve got this working now! One more quick question do I need to create a name and password for each individual script?
Awesome, glad you got it working.
No you don’t have to, you could technically use the same name and key for everything, but it’s not a good practice. Thought it really depends on your pipeline and workflow.
If you’re just getting started with the daemon, maybe create one script name/key per plugin, then once you’re up and running and have many plugins to handle, then maybe some of the plugins that are on the same VMs could share a name/key.