Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private harbor fix #725

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ get_resource_options() {
else
resources=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" https://(HOST)/skaha/(SKAHA_API_VERSION)/context`
fi
core_default=`echo $resources | jq .cores.default`
core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '`
ram_default=`echo $resources | jq .memoryGB.default`
ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '`

core_default=`echo $resources | jq .cores.default`
core_options=`echo $resources | jq .cores.options[] | tr '\n' ' '`
ram_default=`echo $resources | jq .memoryGB.default`
ram_options=`echo $resources | jq .memoryGB.options[] | tr '\n' ' '`
}

get_cores() {
Expand Down Expand Up @@ -89,7 +90,7 @@ prompt_user() {
if [ -z "${TOKEN}" ]; then
handle_error "[skaha] No credentials to call back to Skaha with."
else
app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
fi
break
elif [[ ${yn} == "y" || ${yn} == "Y" ]]; then
Expand All @@ -101,7 +102,7 @@ prompt_user() {
if [ -z "${TOKEN}" ]; then
handle_error "[skaha] No credentials to call back to Skaha with."
else
app_id=`curl -s -L -k "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
app_id=`curl -s -L -k --header "x-auth-token-skaha: ${TOKEN}" -d "cores=${cores}" -d "ram=$ram" -d "image=(IMAGE_ID)" --data-urlencode "param=(NAME)" https://(HOST)/skaha/(SKAHA_API_VERSION)/session/${VNC_PW}/app`
fi
break
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,15 @@
package org.opencadc.skaha;

import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.net.HttpDelete;
import ca.nrc.cadc.net.HttpPost;
import ca.nrc.cadc.reg.Standards;
import ca.nrc.cadc.reg.client.RegistryClient;
import ca.nrc.cadc.util.Log4jInit;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.PrivilegedExceptionAction;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.security.auth.Subject;
Expand Down
8 changes: 4 additions & 4 deletions skaha/src/intTest/java/org/opencadc/skaha/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ public class SessionUtil {
public static final URI SKAHA_SERVICE_ID = URI.create("ivo://cadc.nrc.ca/skaha");
private static final Logger LOGGER = Logger.getLogger(SessionUtil.class);
private static final long ONE_SECOND = 1000L;
private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 120L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 120L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_STARTUP_MS = 180L * SessionUtil.ONE_SECOND;
private static final long TIMEOUT_WAIT_FOR_SESSION_TERMINATE_MS = 180L * SessionUtil.ONE_SECOND;

static URI getSkahaServiceID() {
final String configuredServiceID = System.getenv("SKAHA_SERVICE_ID");
return StringUtil.hasText(configuredServiceID) ? URI.create(configuredServiceID) : SessionUtil.SKAHA_SERVICE_ID;
}

static void initializeCleanup(final URL sessionURL) throws Exception {
for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) {
for (Session session : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) {
if (session.getType().equals(SessionAction.TYPE_DESKTOP_APP)) {
// delete desktop-app
String sessionID = session.getId();
Expand All @@ -139,7 +139,7 @@ static void initializeCleanup(final URL sessionURL) throws Exception {
}

int count = 0;
for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING, Session.STATUS_SUCCEEDED)) {
for (Session s : SessionUtil.getSessions(sessionURL, Session.STATUS_TERMINATING)) {
if (!s.getType().equals(SessionAction.TYPE_DESKTOP_APP)) {
count++;
}
Expand Down