Checkout extension licenses with concurrent use

692
10
Jump to solution
01-09-2018 01:56 PM
Highlighted
New Contributor III

I need to run a Visibility analysis, which requires a Spatial Analyst license. In ArcObjects, I enable/checkout a license using the IExtensionManagerAdmin and IExtensionConfig interfaces, then call the Visibility method on ISurfaceOp2.

In the ArcGIS Pro SDK, I believe Visibility analysis must be run through the geoprocessing tool, and our administrator enabled a Spatial Analyst license for my Named User license. How would I enable/checkout a license in a Concurrent Use environment? Would ArcGIS Pro check one out automatically as needed? The only functionality I can find right now is to check whether or not a license is available via LicenseInformation.IsAvailable, but I can't find how to actively check one out.

Thanks!

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Esri Regular Contributor

Hi Stephen, this is in the upcoming Pro SDK at 2.2.

View solution in original post

10 Replies
Highlighted
Esri Contributor

Hi Stephen, your understanding is correct:

"Would ArcGIS Pro check one out automatically as needed?"

Yes it would. The licensing behavior of Pro is the same whether it is being exercised via its "COTS" UI or via code in a custom add-in.

Highlighted
New Contributor III

Awesome. Thanks!

Reply
0 Kudos
Highlighted
New Contributor III

Hey Charles, can you provide some more clarity on what "automatically checking out" means? I've run the code below through 3 different scenarios:

  1. Named User license with 3D Analyst configured on the server.
  2. Concurrent Use license with 3D Analyst checked out via the License Configuration window.
  3. Concurrent Use license with 3D Analyst NOT checked out via the License Configuration window (screenshot below).

Scenarios 1 and 2 work fine, but Scenario 3 errors with code 2147483647. What does that code mean? The first line in the code returns that a license is available in all 3 scenarios, even though the UI says the Visibility tool is unavailable in Scenario 3.

My understanding of "automatically check out" is that the the UI will detect that an add-in needs a license, poll the license server, and check one out. Is that correct? If it makes any difference, I'm using a Basic license. This is important functionality because we can't expect our users to remember to check-out and check-in a license every time they want to use our tools.

Debug.WriteLine($"3D Analyst license available: {LicenseInformation.IsAvailable(LicenseCodes.Analyst3D)}");

var progressorSource = new CancelableProgressorSource("Creating visibility raster", "");
var paramDictionary = new Dictionary<string, string>();

paramDictionary.Add("in_raster", elevationRaster);
paramDictionary.Add("in_observer_features", observerLayerName);
paramDictionary.Add("out_raster", rasterPath);

var environments = Geoprocessing.MakeEnvironmentArray(
outputCoordinateSystem: MapView.Active.Map.SpatialReference,
extent: MapView.Active.Extent);

var result = await Geoprocessing.ExecuteToolAsync("Visibility_3d", paramDictionary.Values,
environments, progressorSource.Progressor, GPExecuteToolFlags.RefreshProjectItems | GPExecuteToolFlags.AddToHistory);

// Process the result's error code and messages‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks!

Reply
0 Kudos
Highlighted
Esri Contributor

If scenario 3 works when you run the GP from the GP dockpane but not when the tool is called inside an Add-in could mean we have a bug. However, If scenario 3 does not work when you run the GP "manually" then it won't work inside the Add-in either.

Reply
0 Kudos
Highlighted
New Contributor III

In scenario 3, the tool is unavailable in the GP dockpance with a note that it isn't licensed. It seems like ArcGIS Pro doesn't automatically check one out, but instead relies on the user to do so. Is that actually the case? My wording may have been unclear in the original question. If so, how soon can the ability to check a license out be added to the .NET API?

I found this idea on the ArcGIS Ideas forums relating to this issue: Automatically turn on licensed extensions when needed 

Reply
0 Kudos
Highlighted
New Contributor III

Special thanks to Charles Macleod for looking into this at the DevSummit! This isn't yet available in the .NET SDK, but the CheckInExtension and CheckOutExtension methods are available in the Python SDK for a workaround in the meantime.

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Hi Stephen, this is in the upcoming Pro SDK at 2.2.

View solution in original post

Highlighted
New Contributor III

Thanks, Chris!

Reply
0 Kudos
Highlighted
New Contributor

Hi, is it possible to check which extension (Concurrent Use) is enabled (checked out) via the License Configuration window. As I see, it is possible to get the current license level held by the user using ArcGIS.Core.Licensing Namespace > LicenseInformation Class : Level Property. But I don't see a way to get the same for extensions. ArcGIS.Core.Licensing Namespace > LicenseInformation Class : IsAvailable Method lists all the extensions which are available on the license server, but how to get which of them are enabled by the user?

Reply
0 Kudos