Skip to content

Commit

Permalink
style(pre-commit): various pre-commit based linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shinybrar committed Nov 25, 2024
1 parent 41776f5 commit 0b7c246
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.25.0"
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This project has been funded in part by:
Skaha is a general purpose online platform for running science containers interactively. It is part of the [CANFAR Science Platform](https://canfar.net). In the architecture diagram below, skaha is the main API to the Science Platform.

![science-platform-architecture](docs/images/canfar-architecture-2024-04-08.png)
The CANFAR Science Platform Architecture.
The CANFAR Science Platform Architecture.
![canfar-architecture](docs/images/canfar-architecture-1.0.png)
Skaha is the API to the Science Platform box.

Expand Down Expand Up @@ -74,4 +74,4 @@ skaha relies on a number of other opencadc modules to operate.
* access control (ac) web service (https://github.com/opencadc/ac) -- If the IdentityManager implementation is configured to use cadc-access-control-server for authentication an operational ac web service is required to be running.
* credential delegation (cdp) web service (https://github.com/opencadc/cdp) -- The cdp service is used to obtain users' delegated proxy certificates.
* cavern -- skaha is complimented by having the cavern VOSpace implementation mounted as a shared POSIX file system. (https://github.com/opencadc/vos/tree/master/cavern). cavern is a vospace implementation where both the data and metadata are based on the contents of a file system. If the software-containers have access to the cavern file system the contents of that file system can be accessed and shared through the cavern web service.
* posix/sssd -- Containers in skaha are always run _as the user_ and with the users' group memberships. If skaha-desktop and software-containers are run with a SSSD configuration that points to the same LDAP instance as used by ac, the names of those uids and gids can be resolved.
* posix/sssd -- Containers in skaha are always run _as the user_ and with the users' group memberships. If skaha-desktop and software-containers are run with a SSSD configuration that points to the same LDAP instance as used by ac, the names of those uids and gids can be resolved.
2 changes: 1 addition & 1 deletion image-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This builds a simple image with some formatting tools to support the image cachi
to a running Redis cache. See the [cache-images.sh script](https://github.com/opencadc/science-platform/blob/main/deployment/helm/skaha/image-cache/cache-images.sh) in
Skaha, which is run from _within_ this Image.

See also the [`CronJob` and initialization `Job`](https://github.com/opencadc/science-platform/blob/main/deployment/helm/skaha/templates/image-caching-cronjob.yaml) on how this image is used from a Skaha deployment.
See also the [`CronJob` and initialization `Job`](https://github.com/opencadc/science-platform/blob/main/deployment/helm/skaha/templates/image-caching-cronjob.yaml) on how this image is used from a Skaha deployment.
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
}
},
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
}
}
2 changes: 1 addition & 1 deletion skaha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ These two kubernetes job configuration files are templates used by skaha to run

## apply version tags
```bash
. VERSION && echo "tags: $TAGS"
. VERSION && echo "tags: $TAGS"
for t in $TAGS; do
docker image tag images.canfar.net/skaha-system/skaha:latest images.canfar.net/skaha-system/skaha:$t
done
Expand Down
2 changes: 1 addition & 1 deletion skaha/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ minorVersion = 25
# x-release-please-end
# x-release-please-start-patch
patchVersion = 0
# x-release-please-end
# x-release-please-end
4 changes: 2 additions & 2 deletions skaha/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
30 changes: 15 additions & 15 deletions skaha/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>skaha</display-name>

<servlet>
<servlet-name>logControl</servlet-name>
<servlet-class>ca.nrc.cadc.log.LogControlServlet</servlet-class>
Expand All @@ -21,18 +21,18 @@
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>SessionServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
<init-param>
<param-name>get</param-name>
<param-value>org.opencadc.skaha.session.GetAction</param-value>
<param-value>org.opencadc.skaha.session.GetAction</param-value>
<!-- <param-value>org.opencadc.platform.docker.DockerGet</param-value> -->
</init-param>
<init-param>
<param-name>post</param-name>
<param-value>org.opencadc.skaha.session.PostAction</param-value>
<param-value>org.opencadc.skaha.session.PostAction</param-value>
<!-- <param-value>org.opencadc.platform.docker.DockerPost</param-value> -->
</init-param>
<init-param>
Expand All @@ -50,24 +50,24 @@
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet>
<servlet-name>ContextServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
<init-param>
<param-name>get</param-name>
<param-value>org.opencadc.skaha.context.GetAction</param-value>
<param-value>org.opencadc.skaha.context.GetAction</param-value>
<!-- <param-value>org.opencadc.platform.docker.DockerGet</param-value> -->
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
<init-param>
<param-name>get</param-name>
<param-value>org.opencadc.skaha.image.GetAction</param-value>
<param-value>org.opencadc.skaha.image.GetAction</param-value>
<!-- <param-value>org.opencadc.platform.docker.DockerGet</param-value> -->
</init-param>
<load-on-startup>2</load-on-startup>
Expand Down Expand Up @@ -117,17 +117,17 @@
</servlet>

<!-- URL-to-servlet mapping -->

<servlet-mapping>
<servlet-name>SessionServlet</servlet-name>
<url-pattern>/v0/session/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ContextServlet</servlet-name>
<url-pattern>/v0/context/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>/v0/image/*</url-pattern>
Expand All @@ -137,23 +137,23 @@
<servlet-name>ImageRepositoryServlet</servlet-name>
<url-pattern>/v0/repository/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>CapabilitiesServlet</servlet-name>
<url-pattern>/capabilities</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>AvailabilityServlet</servlet-name>
<url-pattern>/availability</url-pattern>
</servlet-mapping>

<!-- Log control servlet endpoint -->
<servlet-mapping>
<servlet-name>logControl</servlet-name>
<url-pattern>/logControl</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
Expand Down
3 changes: 1 addition & 2 deletions skaha/src/main/webapp/capabilities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<accessURL use="full">https://replace.me.com/skaha/availability</accessURL>
</interface>
</capability>

<capability standardID="vos://cadc.nrc.ca~vospace/CADC/std/Logging#control-1.0">
<interface xsi:type="vs:ParamHTTP" role="std" version="1.0">
<accessURL use="full">https://replace.me.com/skaha/logControl</accessURL>
Expand All @@ -38,4 +38,3 @@
</capability>

</vosi:capabilities>

2 changes: 1 addition & 1 deletion skaha/src/main/webapp/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ paths:
in: query
type: string
description: |
The name for the session (for user informational purposes only).
The name for the session (for user informational purposes only).
required: true
- name: image
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@
public class DockerDelete extends DeleteAction {

private static final Logger log = Logger.getLogger(DockerDelete.class);

@Override
public void stopSession(String userID, String sessionID) throws Exception {
// kill the session specified by sessionID
log.debug("Stopping VNC session");
String[] stopVNCCmd = new String[] {"/scripts/docker/stop-desktop.sh", userID, sessionID};
execute(stopVNCCmd);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@
import ca.nrc.cadc.util.StringUtil;

public class DockerGet extends GetAction {

private static final Logger log = Logger.getLogger(DockerGet.class);

@Override
public void listSessions() throws Exception {

String[] getVNCSessions = new String[] {"docker", "ps", "--format", "{{.Names}}\\t{{.Status}}", "--filter", "label=canfar-net-userid=" + userID};
String vncSessions = execute(getVNCSessions);

if (StringUtil.hasLength(vncSessions)) {
String[] lines = vncSessions.split("\n");
if (lines.length > 0) {
Expand Down Expand Up @@ -120,21 +120,21 @@ public void listSessions() throws Exception {
}
log.debug("No container listing output");
}

protected String parseCID(String vncName) {
String[] parts = vncName.split("_");
String sessionID = parts[parts.length - 2];
return sessionID;
}

protected String parseCURL(String vncName) throws IOException, InterruptedException {
String sessionID = parseCID(vncName);
String[] getIpCmd = new String[] {
"docker", "inspect", "--format", "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}", vncName};
String ipAddress = execute(getIpCmd);
return getVNCURL(server, sessionID, ipAddress);
}

protected String parseCName(String vncName) {
String[] parts = vncName.split("_");
return parts[parts.length - 1];
Expand Down
24 changes: 12 additions & 12 deletions skaha/src/obsolete/java/org/opencadc/arcade/docker/DockerPost.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
import ca.nrc.cadc.util.StringUtil;

public class DockerPost extends PostAction {

private static final Logger log = Logger.getLogger(DockerPost.class);

@Override
public void checkForExistingSession(String userid) throws Exception {
String[] getVNCSessions = new String[] {"docker", "ps", "--format", "{{.Names}}\\t{{.Status}}", "--filter", "label=canfar-net-userid=" + userID};
Expand All @@ -93,48 +93,48 @@ public void checkForExistingSession(String userid) throws Exception {
}
}
}

@Override
public URL createSession(String sessionID, String name) throws Exception {

String[] runNoVNCCmd = new String[] {"/scripts/docker/run-desktop.sh", userID, sessionID, name, homedir, scratchdir};
String imageID = execute(runNoVNCCmd);

// insert the user's proxy cert on the container
Subject subject = AuthenticationUtil.getCurrentSubject();
//injectProxyCert("/home", subject, userID);

String[] getIpCmd = new String[] {
"docker", "inspect", "--format", "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}", imageID};
String ipAddress = execute(getIpCmd);

// give vnc a few seconds to initialize
try {
log.debug("3 second wait for vnc initialization");
Thread.sleep(2000);
} catch (InterruptedException ignore) {
}
log.debug("wait over");

String redirectPath = super.getVNCURL(server, sessionID, ipAddress);
return new URL(redirectPath);
}

@Override
public void attachSoftware(String software, List<String> params, String targetIP) throws Exception {

confirmSoftware(software);

// only one parameter supported for now
String param = "xterm";
if (params != null && params.size() > 0) {
param = params.get(0);
}
log.debug("Using parameter: " + param);

String[] runAppCmd = new String[] {"/scripts/docker/software.sh", software, targetIP, userID, homedir, scratchdir, param};
String imageID = execute(runAppCmd);

// refresh the user's proxy cert
Subject subject = AuthenticationUtil.getCurrentSubject();
//injectProxyCert("/home", subject, userID);
Expand Down

0 comments on commit 0b7c246

Please sign in to comment.