Ticket #9089 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Add keepalive implementation

Reported by: Jay Rainey Owned by: Jay Rainey
Priority: major Milestone: Release 3.2
Component: Framework Keywords: ICAT
Cc: Blocked By: #9084
Blocking: Tester: Martyn Gigg

Description

Currently, ICatalog has a method named keepAlive, which is not implemented in any of the inherited catalogs. Ideally, this should have an implementation that keeps the session of the catalog alive indefinitely.

Change History

comment:1 Changed 7 years ago by Nick Draper

  • Status changed from new to assigned

comment:2 Changed 7 years ago by Jay Rainey

  • Blocked By 9084 added

comment:3 Changed 7 years ago by Jay Rainey

  • Status changed from assigned to inprogress

Added ICat4 implementation for keepAlive. Refs #9089.

Changeset: 4d3f02348955e6a5f4920548ede6bf745512184d

comment:4 Changed 7 years ago by Jay Rainey

Added CatalogKeepAlive algorithm. Refs #9089.

  • This allows external scripts and GUIs within Mantid to keep the catalog alive.

Changeset: a3ac546578c1350b50e03edd926b75a67be60e9a

comment:5 Changed 7 years ago by Jay Rainey

Execute KeepAlive when logged in. Refs #9089.

Changeset: a323ad5c7130779d5dbf15f9c2b7a333c53706fc

comment:6 Changed 7 years ago by Jay Rainey

Output the keep alive algorithm. Refs #9089.

  • Renamed login keepAlive property to prevent confusion.

Changeset: 3fe12a780afb42457c6a9a90d4ababc9aa23ae04

comment:7 Changed 7 years ago by Jay Rainey

Execute keepAlive every 20 minutes. Refs #9089.

Changeset: 4a789f86bb928208dac7088a2c154ce0430debf8

comment:8 Changed 7 years ago by Jay Rainey

Updated catalogLogout documentation. Refs #9089.

Changeset: f9d902e363da6db8bff4aa230a566ccd89406e02

comment:9 Changed 7 years ago by Jay Rainey

Cancel algorithm based on session info. Refs #9089.

Changeset: a9f560c3a0df4e1b2f66bbc219fe0e420145d7c4

comment:10 Changed 7 years ago by Jay Rainey

Attempt to fix WIN build. Refs #9089.

  • No need for this property to be a long as it's now in seconds.

Changeset: d3364c7ff3a7ebf2355ef03d4424866e6f5eb223

comment:11 Changed 7 years ago by Jay Rainey

Removed unnecessary thread use. Refs #9089.

Changeset: 38b9067dea1a2628f5a6465a5e1b0410a9aaca59

comment:12 Changed 7 years ago by Jay Rainey

  • Status changed from inprogress to verify
  • Resolution set to fixed

It's difficult to verify that the session is actually kept alive other than waiting 2 hours (default limit) and then searching to see if it's alive. Instead, a code review should be performed to verify that the functionality will work as expected.

To test

  1. Open the catalog login dialog (Catalog -> Login) and enter your credentials.
  2. In the dialog check the KeepSessionAlive option.
  3. Note that the CatalogKeepAlive has been executed. You can view details of this algorithm by clicking the Details option to the right of the progress bar.

Verify the following

  1. Pressing Cancel from the Details option cancels the CatalogKeepAlive algorithm.
  2. Clicking Logout from the catalog menu terminates all active catalogs.
  3. You should manually remove this line in order to verify that CatalogKeepAlive works across multiple catalogs. To do this, just log into the catalog again with the same credentials.

comment:13 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:14 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to reopened
  • Resolution fixed deleted

Generally this is fine & the code looks good.

I think there is a small improvement we can make. At the moment if you login to ICat and then look at the processor usage then you see 1 thread continuously polling. It seems a bit wasteful for 1 thread to be completely occupied by doing this. However, we need to check reasonably frequently for cancellation to be usable.

My suggestion is to add a Poco::Thread::sleep(1000) call to the start of the while(true) loop. This way the thread will not be continously checking and will simply wake up briefly for a second to do the work and then sleep again. To be clearer the loop cold look like:

while (true)
{
  Poco::Thread::sleep(1000);
  ...

comment:15 Changed 7 years ago by Jay Rainey

  • Status changed from reopened to inprogress

Check every second. Refs #9089.

Changeset: dd77ce14c83c98efb6a69d54f911836479c2059a

comment:16 Changed 7 years ago by Jay Rainey

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:17 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to verifying

comment:18 Changed 7 years ago by Martyn Gigg

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/9089_icat_keep_alive'

Full changeset: 799f89edb4a89b7d53d3e61f33c0b0a5a06ff008

comment:19 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9932

Note: See TracTickets for help on using tickets.