Hi Tomas,

On  Fr 18 Mai 2018 11:12:33 CEST, Tomáš Cerha wrote:

Dear list,

I am using the X2Go Python API to develop a custom UI for running our applications from (mainly) Windows client machines.

When starting an application based on a session profile obtained from the X2Go broker, I am checking for the suspended sessions on the server by calling X2GoClient.list_sessions().

X2GoClient.list_sessions() returns the list of all sessions on the server, including also sessions of other profiles. I need to filter them out to include only the sessions of the same profile, which is currently starting.

The X2GoSessionInfo instances, however, don’t include the information I need. I need the profile name, profile id or at least the command. The command is included in the session name, but I don’t feel that parsing the session name is the right way to go.

Thus I tried to obtain more information about the session using X2GoClient.get_session_of_session_name(), but it returns None for all session names returned by X2GoClient.list_sessions().

I also tried to pass profile_name or profile_id to X2GoClient.list_sessions() but it is probably not meant to filter the sessions as I am still receiving the complete list of sessions including also sessions of other profiles.

So is there a way to find out the profile name, profile id or command of a suspended session returned by X2GoClient.list_sessions()?

The point is that the profile names / profile IDs are client-side only. Nothing on the server is aware of them.

What you can do is, you can write some code that matches settings of the running session (all hidden in the session name string) with matches in the local session profiles.

However, this mapping will and can never, in all thinkable generic case, be bijective.

What I do in another project, I compare the commands that launched the session. For this, I quite recently added this commit:
https://code.x2go.org/gitweb?p=python-x2go.git;a=commitdiff;h=f89baa4e4c810f3f1b30e8ce080769d0f996fb43

Mike

--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de

Attachment: pgpvLjAK7gHJ5.pgp
Description: Digitale PGP-Signatur

_______________________________________________
x2go-dev mailing list
x2go-dev@lists.x2go.org
https://lists.x2go.org/listinfo/x2go-dev

Reply via email to