Wanting to change licence midway througha model

2939
3
Jump to solution
07-09-2015 03:46 PM
Leith_JohnHAWKINS
New Contributor III

Hi There,

because of the way our licensing model works we get charged per minute on sliding scale of what type of license we are using,  I am trying to reduce my costs by changing license level throughout the processing.

  I was wondering is there a way to change licenses levels halfway through a model or a python script ?  I have searched for a tool but cant find it   however if there was a python snippet that would do the job it would be awesome.

TIA

Leith

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

I believe that this can be done in ArcObjects via IAoInitialize, but it isn't possible out-of-the box with Python or ModelBuilder. From ModelBuilder within the UI the license is derived from the ArcGIS application used to open the model (i.e. if you open the model in ArcMap with a Basic license the model will use a Basic license).

Within python there was a method in the 9.2 days called SetProduct, which could be used to set the license, but it appears that function has been deprecated by the arcpy site package. With arcpy you'd need to set the license prior to importing the arcpy site package, so it wouldn't allow you to change licenses in the middle of the tool.

setProduct.png

This is just a guess, but you may be able to get what you need to work in python if you run the various parts of your workflow on separate processes. When the new process starts you'd begin by importing the license level needed (i.e. arcinfo, arceditor, arcview, arcserver, arcenginegeodb, or arcengine) and execute your needed logic. Once the process ends and returns the license you'd begin the next process with the next needed license. This of course would be assuming that you had a concurrent use license that has the different license levels available.

Accessing licenses and extensions in Python

http://desktop.arcgis.com/en/desktop/latest/analyze/python/access-to-licensing-and-extensions.htm

View solution in original post

3 Replies
FreddieGibson
Occasional Contributor III

I believe that this can be done in ArcObjects via IAoInitialize, but it isn't possible out-of-the box with Python or ModelBuilder. From ModelBuilder within the UI the license is derived from the ArcGIS application used to open the model (i.e. if you open the model in ArcMap with a Basic license the model will use a Basic license).

Within python there was a method in the 9.2 days called SetProduct, which could be used to set the license, but it appears that function has been deprecated by the arcpy site package. With arcpy you'd need to set the license prior to importing the arcpy site package, so it wouldn't allow you to change licenses in the middle of the tool.

setProduct.png

This is just a guess, but you may be able to get what you need to work in python if you run the various parts of your workflow on separate processes. When the new process starts you'd begin by importing the license level needed (i.e. arcinfo, arceditor, arcview, arcserver, arcenginegeodb, or arcengine) and execute your needed logic. Once the process ends and returns the license you'd begin the next process with the next needed license. This of course would be assuming that you had a concurrent use license that has the different license levels available.

Accessing licenses and extensions in Python

http://desktop.arcgis.com/en/desktop/latest/analyze/python/access-to-licensing-and-extensions.htm

SamuelTompsett
Occasional Contributor II

I couldn't get the link to work for SetProduct within arcpy resources. However, if you google, SetProduct arcpy esri, you should be able to find the documentation.

-Sam

Leith_JohnHAWKINS
New Contributor III

Thanks thats just the Info I was after.

Thanks

Leith

0 Kudos