RStudio instance allocation takes into account the VO and not the VRE
This commit is contained in:
parent
b99319c450
commit
d824cda0ec
|
@ -3,5 +3,4 @@ encoding//src/main/java=UTF-8
|
||||||
encoding//src/main/resources=UTF-8
|
encoding//src/main/resources=UTF-8
|
||||||
encoding//src/test/java=UTF-8
|
encoding//src/test/java=UTF-8
|
||||||
encoding//src/test/resources=UTF-8
|
encoding//src/test/resources=UTF-8
|
||||||
encoding//target/generated-sources/gwt=UTF-8
|
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
# Changelog for RStudio Wrapper Portlet
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.5.0-SNAPSHOT] - 2021-04-21
|
||||||
|
|
||||||
|
- RStudio instance allocation takes into account the number of instance available in the VO and not in the context and assign the RStudio instance balancing the load.
|
||||||
|
|
||||||
|
- The user is always redirected to the same endpoint, until a gCore Endpoint disappears, if so a new allocation is calculated.
|
||||||
|
|
||||||
|
## [v1.3.1] - 2019-10-07
|
||||||
|
|
||||||
|
- RStudio instances returned over https now
|
||||||
|
|
||||||
|
|
||||||
|
## [v1.3.0] -2017-02-21
|
||||||
|
|
||||||
|
- RStudio instance allocation takes into account the number of instance available in the given context and assign the RStudio instance balancing the load.
|
||||||
|
|
||||||
|
- Added possibility to look for service endpoint RConnector resource in the scope
|
||||||
|
|
||||||
|
## [v1.0.0] -2016-04-11
|
||||||
|
|
||||||
|
- First release
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Acknowledgments
|
||||||
|
|
||||||
|
The projects leading to this software have received funding from a series of European Union programmes including:
|
||||||
|
|
||||||
|
- the Sixth Framework Programme for Research and Technological Development
|
||||||
|
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
|
||||||
|
- the Seventh Framework Programme for research, technological development and demonstration
|
||||||
|
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
|
||||||
|
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
|
||||||
|
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
|
||||||
|
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
|
||||||
|
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
|
||||||
|
- the H2020 research and innovation programme
|
||||||
|
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
|
||||||
|
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
|
||||||
|
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
|
||||||
|
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
|
||||||
|
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
|
||||||
|
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
|
||||||
|
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
|
||||||
|
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
|
||||||
|
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
|
||||||
|
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
|
||||||
|
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
|
||||||
|
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
|
||||||
|
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);
|
|
@ -1 +0,0 @@
|
||||||
${gcube.license}
|
|
|
@ -1,62 +0,0 @@
|
||||||
The gCube System - ${name}
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
${description}
|
|
||||||
|
|
||||||
|
|
||||||
${gcube.description}
|
|
||||||
|
|
||||||
${gcube.funding}
|
|
||||||
|
|
||||||
|
|
||||||
Version
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
${version} (${buildDate})
|
|
||||||
|
|
||||||
Please see the file named "changelog.xml" in this directory for the release notes.
|
|
||||||
|
|
||||||
|
|
||||||
Authors
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
|
||||||
|
|
||||||
Maintainers
|
|
||||||
-----------
|
|
||||||
|
|
||||||
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
|
||||||
|
|
||||||
Download information
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
Source code is available from SVN:
|
|
||||||
${scm.url}
|
|
||||||
|
|
||||||
Binaries can be downloaded from the gCube website:
|
|
||||||
${gcube.website}
|
|
||||||
|
|
||||||
|
|
||||||
Installation
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
Installation documentation is available on-line in the gCube Wiki:
|
|
||||||
${gcube.wikiRoot}
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
Documentation is available on-line in the gCube Wiki:
|
|
||||||
${gcube.wikiRoot}
|
|
||||||
|
|
||||||
Support
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
Bugs and support requests can be reported in the gCube issue tracking tool:
|
|
||||||
${gcube.issueTracking}
|
|
||||||
|
|
||||||
|
|
||||||
Licensing
|
|
||||||
--------------------------------------------------
|
|
||||||
|
|
||||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
|
@ -1,25 +0,0 @@
|
||||||
<ReleaseNotes>
|
|
||||||
<Changeset component="org.gcube.portlet.user.rstudio-wrapper-portlet.1-3-1"
|
|
||||||
date="2019-10-07">
|
|
||||||
<Change>RStudio instances returned over https now
|
|
||||||
</Change>
|
|
||||||
<Change>Ported to Java8 and gwt 2.8.2
|
|
||||||
</Change>
|
|
||||||
</Changeset>
|
|
||||||
<Changeset component="org.gcube.portlet.user.rstudio-wrapper-portlet.1-3-0"
|
|
||||||
date="2017-02-21">
|
|
||||||
<Change>RStudio instance allocation takes into account the number of instance available in the given context and assign the RStudio instance balancing the load.
|
|
||||||
</Change>
|
|
||||||
</Changeset>
|
|
||||||
<Changeset component="org.gcube.portlet.user.rstudio-wrapper-portlet.1-2-0"
|
|
||||||
date="2016-09-15">
|
|
||||||
<Change>added possibility to look for service endpoint RConnector
|
|
||||||
resource in the
|
|
||||||
scope
|
|
||||||
</Change>
|
|
||||||
</Changeset>
|
|
||||||
<Changeset component="org.gcube.portlet.user.rstudio-wrapper-portlet.1-0-0"
|
|
||||||
date="2016-04-11">
|
|
||||||
<Change>First Release</Change>
|
|
||||||
</Changeset>
|
|
||||||
</ReleaseNotes>
|
|
|
@ -1,31 +0,0 @@
|
||||||
<assembly
|
|
||||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
|
||||||
<id>servicearchive</id>
|
|
||||||
<formats>
|
|
||||||
<format>tar.gz</format>
|
|
||||||
</formats>
|
|
||||||
<baseDirectory>/</baseDirectory>
|
|
||||||
<fileSets>
|
|
||||||
<fileSet>
|
|
||||||
<directory>${distroDirectory}</directory>
|
|
||||||
<outputDirectory>/</outputDirectory>
|
|
||||||
<useDefaultExcludes>true</useDefaultExcludes>
|
|
||||||
<includes>
|
|
||||||
<include>README</include>
|
|
||||||
<include>LICENSE</include>
|
|
||||||
<include>changelog.xml</include>
|
|
||||||
<include>profile.xml</include>
|
|
||||||
</includes>
|
|
||||||
<fileMode>755</fileMode>
|
|
||||||
<filtered>true</filtered>
|
|
||||||
</fileSet>
|
|
||||||
</fileSets>
|
|
||||||
<files>
|
|
||||||
<file>
|
|
||||||
<source>target/${build.finalName}.${project.packaging}</source>
|
|
||||||
<outputDirectory>/${artifactId}</outputDirectory>
|
|
||||||
</file>
|
|
||||||
</files>
|
|
||||||
</assembly>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<ID></ID>
|
|
||||||
<Type>Service</Type>
|
|
||||||
<Profile>
|
|
||||||
<Description>${description}</Description>
|
|
||||||
<Class>PortletUser</Class>
|
|
||||||
<Name>${artifactId}</Name>
|
|
||||||
<Version>${version}</Version>
|
|
||||||
<Packages>
|
|
||||||
<Software>
|
|
||||||
<Name>${artifactId}</Name>
|
|
||||||
<Version>${version}</Version>
|
|
||||||
<MavenCoordinates>
|
|
||||||
<groupId>${groupId}</groupId>
|
|
||||||
<artifactId>${artifactId}</artifactId>
|
|
||||||
<version>${version}</version>
|
|
||||||
</MavenCoordinates>
|
|
||||||
<Files>
|
|
||||||
<File>target/${build.finalName}.war</File>
|
|
||||||
</Files>
|
|
||||||
</Software>
|
|
||||||
</Packages>
|
|
||||||
</Profile>
|
|
||||||
</Resource>
|
|
4
pom.xml
4
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>rstudio-wrapper-portlet</artifactId>
|
<artifactId>rstudio-wrapper-portlet</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>1.4.0</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
<name>RStudio Wrapper Portlet</name>
|
<name>RStudio Wrapper Portlet</name>
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
|
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
<artifactId>common-scope-maps</artifactId>
|
<artifactId>common-scope-maps</artifactId>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.data.analysis</groupId>
|
<groupId>org.gcube.data.analysis</groupId>
|
||||||
|
|
|
@ -185,58 +185,48 @@ public class RStudioServiceImpl extends RemoteServiceServlet implements RStudioS
|
||||||
_log.info("User " + curUser.getFullname() + " has RStudio Instance set and is valid, returning rConnector URL " + toReturn);
|
_log.info("User " + curUser.getFullname() + " has RStudio Instance set and is valid, returning rConnector URL " + toReturn);
|
||||||
}
|
}
|
||||||
else {//need to find the RStudio
|
else {//need to find the RStudio
|
||||||
//check first if there is an instance allocated on another scope
|
|
||||||
_log.info("User " + curUser.getFullname() + " DOES NOT have RStudio Instance set for this context "+context + " check if she as an instance assigned on another context");
|
|
||||||
if (! userRStudioInstances.isEmpty()) {
|
|
||||||
String theFirstInstance = userRStudioInstances.values().iterator().next();
|
|
||||||
toReturn = getRConnectorURL(theFirstInstance, token);
|
|
||||||
_log.info("Found instance: "+ theFirstInstance);
|
|
||||||
writeRStudioInstanceInScope(um, curUser, context, theFirstInstance);
|
|
||||||
_log.debug("User " + curUser.getFullname() + " RStudio gCore Instance set reused = " + theFirstInstance + " for new context " + context);
|
|
||||||
}
|
|
||||||
else { //no instance allocated on another scope
|
|
||||||
_log.info("User " + curUser.getFullname() + " DOES NOT have RStudio Instance set or the instance previous set no longer exists, calculating allocation ... ");
|
|
||||||
|
|
||||||
HashMap<String, Integer> rStudioDistributionMap = new HashMap<>();
|
_log.info("User " + curUser.getFullname() + " DOES NOT have RStudio Instance set or the instance previous set no longer exists, calculating allocation ... ");
|
||||||
for (GCoreEndpoint res : gCoreResources) {
|
HashMap<String, Integer> rStudioDistributionMap = new HashMap<>();
|
||||||
String hostedOn = extractGCoreEndpointHostAndPort(res);
|
for (GCoreEndpoint res : gCoreResources) {
|
||||||
rStudioDistributionMap.put(hostedOn, 0);
|
String hostedOn = extractGCoreEndpointHostAndPort(res);
|
||||||
}
|
rStudioDistributionMap.put(hostedOn, 0);
|
||||||
List<GCubeUser> vreUsers = um.listUsersByGroup(pContext.getCurrentGroupId(getThreadLocalRequest()), false);
|
|
||||||
_log.debug("VRE " + context + " has totalUsers = " + vreUsers.size());
|
|
||||||
for (GCubeUser gCubeUser : vreUsers) {
|
|
||||||
if (getUserRStudioInstances(um,gCubeUser).get(context) != null) {
|
|
||||||
String hostedOn = getUserRStudioInstances(um,gCubeUser).get(context);
|
|
||||||
if (rStudioDistributionMap.containsKey(hostedOn)) {
|
|
||||||
int noToSet = rStudioDistributionMap.get(hostedOn)+1;
|
|
||||||
rStudioDistributionMap.put(hostedOn, noToSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_log.debug("VRE - RStudio allocaiton map as follows: ");
|
|
||||||
int min = 0;
|
|
||||||
int i = 0;
|
|
||||||
String host2Select = "";
|
|
||||||
for (String host : rStudioDistributionMap.keySet()) {
|
|
||||||
_log.debug("Host " + host + " has # users=" + rStudioDistributionMap.get(host));
|
|
||||||
if (i==0) {
|
|
||||||
host2Select = host;
|
|
||||||
min = rStudioDistributionMap.get(host);
|
|
||||||
} else {
|
|
||||||
int usersNo = rStudioDistributionMap.get(host);
|
|
||||||
if (usersNo < min) {
|
|
||||||
_log.debug("Host " + host + " has LESS users than " + host2Select + " updating");
|
|
||||||
host2Select = host;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
writeRStudioInstanceInScope(um, curUser, context, host2Select);
|
|
||||||
_log.debug("User " + curUser.getFullname() + " RStudio gCore Instance set calculated = " + host2Select + " for context " + context);
|
|
||||||
toReturn = getRConnectorURL(host2Select, token);
|
|
||||||
}
|
}
|
||||||
_log.debug("User " + curUser.getFullname() + " has RStudio gCore Instance set, returning rConnector URL " + toReturn);
|
List<GCubeUser> vreUsers = um.listUsersByGroup(pContext.getCurrentGroupId(getThreadLocalRequest()), false);
|
||||||
|
_log.debug("VRE " + context + " has totalUsers = " + vreUsers.size());
|
||||||
|
for (GCubeUser gCubeUser : vreUsers) {
|
||||||
|
if (getUserRStudioInstances(um,gCubeUser).get(context) != null) {
|
||||||
|
String hostedOn = getUserRStudioInstances(um,gCubeUser).get(context);
|
||||||
|
if (rStudioDistributionMap.containsKey(hostedOn)) {
|
||||||
|
int noToSet = rStudioDistributionMap.get(hostedOn)+1;
|
||||||
|
rStudioDistributionMap.put(hostedOn, noToSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_log.debug("VRE - RStudio allocation map as follows: ");
|
||||||
|
int min = 0;
|
||||||
|
int i = 0;
|
||||||
|
String host2Select = "";
|
||||||
|
for (String host : rStudioDistributionMap.keySet()) {
|
||||||
|
_log.debug("Host " + host + " has # users=" + rStudioDistributionMap.get(host));
|
||||||
|
if (i==0) {
|
||||||
|
host2Select = host;
|
||||||
|
min = rStudioDistributionMap.get(host);
|
||||||
|
} else {
|
||||||
|
int usersNo = rStudioDistributionMap.get(host);
|
||||||
|
if (usersNo < min) {
|
||||||
|
_log.debug("Host " + host + " has LESS users than " + host2Select + " updating");
|
||||||
|
host2Select = host;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
writeRStudioInstanceInScope(um, curUser, context, host2Select);
|
||||||
|
_log.debug("User " + curUser.getFullname() + " RStudio gCore Instance set calculated = " + host2Select + " for context " + context);
|
||||||
|
toReturn = getRConnectorURL(host2Select, token);
|
||||||
}
|
}
|
||||||
|
_log.debug("User " + curUser.getFullname() + " has RStudio gCore Instance set, returning rConnector URL " + toReturn);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue