Skip to content

Commit 653ac5d

Browse files
authored
Merge pull request #1807 from Caltech-IPAC/FIREFLY-1794-params
Firefly-1794: parse parameters
2 parents f8a12c0 + bd6d326 commit 653ac5d

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

docs/release-notes.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99

1010
## Version 2025.3
11-
- 2025.3.5 - (July 1, 2025), _docker tag_: `2025.3.5`, `2025.3`, `latest`
11+
- 2025.3.6 - (July 3, 2025), _docker tag_: `2025.3.6`, `2025.3`, `latest`
12+
- 2025.3.5 - (July 1, 2025), _docker tag_: `2025.3.5`
1213
- 2025.3.4 - (June 26, 2025), _docker tag_: `2025.3.4`
1314
- 2025.3.3 - (June 20, 2025), _docker tag_: `2025.3.3`
1415
- 2025.3.2 - (June 16, 2025), _docker tag_: `2025.3.2`
@@ -74,6 +75,8 @@
7475

7576

7677
### _Patches 2025.3_
78+
- 2025.3.6
79+
- Handle Importing job histories URL that have parameters : - Firefly-1794 ([PR](https://github.com/Caltech-IPAC/firefly/pull/1807))
7780
- 2025.3.5
7881
- Fixed: Images: mouse readout with some compressed images- Firefly-1793,Firefly-1792,Firefly-1789 ([PR](https://github.com/Caltech-IPAC/firefly/pull/1804))
7982
- 2025.3.4

src/firefly/java/edu/caltech/ipac/firefly/core/background/JobUtil.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
import java.io.File;
1515
import java.net.InetAddress;
16+
import java.net.URL;
17+
import java.net.URI;
1618
import java.time.Instant;
1719
import java.util.ArrayList;
1820
import java.util.Arrays;
@@ -22,14 +24,17 @@
2224
import java.util.stream.Collectors;
2325

2426
import static edu.caltech.ipac.firefly.core.Util.Opt.ifNotNull;
27+
import static edu.caltech.ipac.firefly.core.Util.Try;
2528
import static edu.caltech.ipac.firefly.core.background.JobInfo.*;
2629
import static edu.caltech.ipac.firefly.core.background.JobInfo.Phase.COMPLETED;
27-
import static edu.caltech.ipac.firefly.core.background.JobInfo.Phase.ERROR;
2830
import static edu.caltech.ipac.firefly.core.background.JobManager.getAllUserJobs;
2931
import static edu.caltech.ipac.firefly.core.background.JobManager.updateJobInfo;
30-
import static edu.caltech.ipac.firefly.server.query.UwsJobProcessor.*;
31-
import static edu.caltech.ipac.util.StringUtils.*;
32-
import static edu.caltech.ipac.firefly.core.Util.Try;
32+
import static edu.caltech.ipac.firefly.server.query.UwsJobProcessor.convertToJobList;
33+
import static edu.caltech.ipac.firefly.server.query.UwsJobProcessor.getUwsJobInfo;
34+
import static edu.caltech.ipac.firefly.server.query.UwsJobProcessor.parse;
35+
import static edu.caltech.ipac.util.StringUtils.applyIfNotEmpty;
36+
import static edu.caltech.ipac.util.StringUtils.getInt;
37+
import static edu.caltech.ipac.util.StringUtils.isEmpty;
3338

3439
public class JobUtil {
3540
// Services are defined as strings with three fields (url|serviceId|serviceType), separated by commas. Only url is required; the others are optional.
@@ -97,18 +102,22 @@ public static int importJobHistories(String svcDef) {
97102
String url = svcParts[0].trim();
98103
String svcId = svcParts.length > 1 ? svcParts[1].trim() : null;
99104
String svcType = svcParts.length > 2 ? svcParts[2].trim() : null;
100-
101105
if (url.isEmpty()) return count;
102106

103-
LOG.debug("Importing job histories from %s; svcId=%s svcType=%s".formatted(url, svcId, svcType));
107+
URL urlObs= Try.it(() -> new URI(url).toURL()).getOrElse((URL)null);
108+
String paramStr= urlObs == null ? "" : urlObs.getQuery();
109+
String urlBase= (!isEmpty(paramStr) && url.contains("?")) ? url.split("\\?")[0] : url;
110+
104111
List<JobInfo> history = getAllUserJobs();
105112

106-
HttpServiceInput input = HttpServiceInput.createWithCredential(url);
113+
HttpServiceInput input = HttpServiceInput.createWithCredential(urlBase);
114+
if (!isEmpty(paramStr)) input.setRequestUrl(input.getRequestUrl()+"?"+paramStr);
115+
LOG.info("Importing job histories from %s; svcId=%s svcType=%s".formatted(input.getRequestUrl(), svcId, svcType));
107116
Ref<List<JobInfo>> jobList = new Ref<>();
108117
HttpServices.getData(input, r -> {
109118
Try.it(() -> {
110119
Document doc = parse(r.getResponseBodyAsStream());
111-
jobList.set(convertToJobList(doc, url));
120+
jobList.set(convertToJobList(doc, urlBase));
112121
}).getOrElse(e -> {
113122
LOG.error("Failed to import job histories from %s: %s".formatted(url, e.getMessage()));
114123
});

src/firefly/java/edu/caltech/ipac/firefly/server/RequestOwner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private void notifyClient(UserInfo userInfo) {
265265
action.setValue(getSsoAdapter().getLoginUrl(""), "login_url");
266266
action.setValue(getSsoAdapter().getLogoutUrl(""), "logout_url");
267267
}
268-
LOG.info("notifyClient new User info: " + userInfo);
268+
LOG.debug("notifyClient new User info: " + userInfo);
269269
ServerEventManager.fireAction(action);
270270
}
271271

src/firefly/java/edu/caltech/ipac/firefly/server/servlets/CommandService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected void processRequest(HttpServletRequest req, HttpServletResponse res) t
7474
var ui= sso.getUserInfo();
7575
if (ui!=null) userInfoStr= ui.toString();
7676
}
77-
Logger.briefInfo(String.format("CommandService: %s (%s): %dms", cmd, userInfoStr, System.currentTimeMillis() - start));
77+
Logger.debug(String.format("CommandService: %s (%s): %dms", cmd, userInfoStr, System.currentTimeMillis() - start));
7878
} catch (Exception ex) {
7979
LOGGER.error(ex);
8080
HashMap<String, String> errors = new HashMap<>();

0 commit comments

Comments
 (0)