Luigi Posted October 11, 2017 Report Share Posted October 11, 2017 At the moment we can start as many instance of Ftrack Connect as we want. In this case in the Actions window in Ftrack Web UI you will get the same actions multiple times. Is it possible to restrict one instance per URL? Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 12, 2017 Report Share Posted October 12, 2017 It is not possible to restrict it at the moment. Do you run them on the same machine or multiple machines but the same user is logged in? Edit: it would probably be possible to do this as a plugin to Connect. Link to comment Share on other sites More sharing options...
Luigi Posted October 13, 2017 Author Report Share Posted October 13, 2017 On 10/12/2017 at 10:36 AM, Mattias Lagergren said: It is not possible to restrict it at the moment. Way not? On 10/12/2017 at 10:36 AM, Mattias Lagergren said: Do you run them on the same machine Yes, on the same machine with the same user. This looks more like a bug. ftrack-connect should not start if it is already running on the same machine by the same user with the same ftrack URL. Way would a user like to start the application 2 times? Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 16, 2017 Report Share Posted October 16, 2017 No good reason, I'm afraid that we haven't implemented support for it yet. Link to comment Share on other sites More sharing options...
Willem Zwarthoed Posted October 17, 2017 Report Share Posted October 17, 2017 If there was a way for the event to return the hostname or ip of the browser from which an action is called you could at least verify on which machine the action is called. This doesn't solve the multiple instances on one machine issue, but for users logged in on multiple workstations you could at least filter out your custom hooks so only those available on that machine are discovered. Remus Avram and John 2 Link to comment Share on other sites More sharing options...
tokejepsen Posted October 17, 2017 Report Share Posted October 17, 2017 +1 for per machine filtering. Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 18, 2017 Report Share Posted October 18, 2017 Unfortunately there is no reliable way of detecting the machine from the browser, not in a way that can be re-created from python. I've made a small plugin (see code below) that detects if there are multiple instances of Connect running for a user and pops up a message. If this functionality makes sense and you like it, we may bundle the plugin in Connect. import logging import socket import functools from QtExt import QtWidgets, QtCore import ftrack_api import ftrack_connect.util import ftrack_connect.ui.application logger = logging.getLogger( 'multiple-instances-plugin' ) def open_warning_dialog(message): '''Open warning window.''' parent = None for item in QtCore.QCoreApplication.instance().topLevelWidgets(): if isinstance(item, ftrack_connect.ui.application.Application): parent = item dialog = QtWidgets.QMessageBox(parent=parent) dialog.setText(message) dialog.setIcon(QtWidgets.QMessageBox.Critical) dialog.exec_() def handle_reply(event): '''Handle reply event if someone else is already running Connect.''' logger.warning('Someone else is already running connect: {0}'.format(event)) ftrack_connect.util.invoke_in_main_thread( open_warning_dialog, u'ftrack Connect is already running on machine: {0}'.format( event['data']['machine'] ) ) def callback(event): '''Handle start of another connect.''' logger.warning('Someone just started ftrack Connect: {0}'.format(event)) ftrack_connect.util.invoke_in_main_thread( functools.partial( open_warning_dialog, u'Connect just opened on machine: {0}'.format( event['data']['machine'] ) ) ) return {'machine': socket.gethostname()} def register(session, **kw): '''Register hooks.''' logger.info( 'Register detection of multiple Connect instances' ) # Validate that session is an instance of ftrack_api.session.Session. If # not, assume that register is being called from an old or incompatible API # and return without doing anything. if not isinstance(session, ftrack_api.Session): logger.debug( 'Not subscribing plugin as passed argument {0!r} is not an ' 'Session instance.'.format(session) ) return session.event_hub.subscribe( 'topic=studio.ftrack-connect.start and source.id != "{0}" and ' 'data.username = "{1}"'.format( session.event_hub.id, session._api_user ), callback ) session.event_hub.publish( ftrack_api.event.base.Event( topic='studio.ftrack-connect.start', data={ 'username': session._api_user, 'machine': socket.gethostname() } ), on_reply=handle_reply ) To use it create a folder detect-multi-instance/hook/ inside the ftrack connectp plugins folder, and add the code in a plugin.py (don't forget the hook/ folder). Restart Connect for the plugin to source. This simple example could be extended with the ability to "quit" other instances of ftrack Connect. Andriy Babak 1 Link to comment Share on other sites More sharing options...
tokejepsen Posted October 18, 2017 Report Share Posted October 18, 2017 10 minutes ago, Mattias Lagergren said: This simple example could be extended with the ability to "quit" other instances of ftrack Connect. +1 Would this work for remote instances of Ftrack Connect as well? Say you are logged into Ftrack Connect on two machines in different locations. Use case that was happened for me Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 18, 2017 Report Share Posted October 18, 2017 3 hours ago, tokejepsen said: Would this work for remote instances of Ftrack Connect as well? Say you are logged into Ftrack Connect on two machines in different locations. Use case that was happened for me Yes, it is using the ftrack event hub service to do this. So it will work in different sites / locations. Link to comment Share on other sites More sharing options...
Martin Pengelly-Phillips Posted October 23, 2017 Report Share Posted October 23, 2017 For reference, we have implemented the concept of a 'huddle' for event plugins that groups published events and listeners around unique discoverable huddle identifiers. So you can have multiple instances of an application such as Maya running for one user and be able to scope events to one particular instance. You can also discover all the available huddles dynamically and allow the user to interactively select between them. Seems to work well so far and greatly simplifies the scoping logic. Link to comment Share on other sites More sharing options...
Mike Overbeck Posted August 11, 2020 Report Share Posted August 11, 2020 Perhaps not a full solution, but would it be possible for fTrack event sources to contain operating system info? This would be very useful for filtering as it's a primary reason for Ftrack Connect logins on multiple machines. LiseR 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now