Skip to content

DM-8179: Preserve background jobs and statuses beyond a browser session. #230

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

Merged
merged 4 commits into from
Nov 17, 2016

Conversation

loitly
Copy link
Contributor

@loitly loitly commented Nov 15, 2016

https://jira.lsstcorp.org/browse/DM-8179
Also, refactor AppDataCntlr.js

Background jobs are saved based on a userKey cookie which remained the same unless inactive for more than 2 weeks.
To test this, starts one or more downloads.
The downloads should be visible in other firefly instances of the same browser.
It should also remain after you reload the application or quit and come back some time later.
Also, cancel and remove are reflected in all instances as well.

Copy link
Contributor

@tgoldina tgoldina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as stated.
I got a note that 'Notification email is sent', but the email field is not synchronized between the browsers. What happens if different emails are entered?
Also, sending email is not supposed to work just yet, right?

import edu.caltech.ipac.firefly.util.event.Name;
import edu.caltech.ipac.util.StringUtils;
import org.apache.xpath.operations.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it used?

private Name name;
private EventTarget target;
private EventTarget target;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double semicolon

@@ -91,6 +88,10 @@ public String toJsonString() {
return sb.toString();
}

public enum Scope {SELF, CHANNEL, USER, WORLD}

public enum DataType {JSON, BG_STATUS, STRING}
Copy link
Contributor

@tgoldina tgoldina Nov 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why did you move those enums down here? It was convenient to have them on top.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was not on purpose. i am guessing intelliJ has something to do with this.

if (scope == ServerEvent.Scope.CHANNEL) {
this.channel = ServerContext.getRequestOwner().getEventChannel();
} else if (scope == Scope.USER) {
this.userKey =ServerContext.getRequestOwner().getUserKey();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The userKey - we rely on a cookie to preserve it, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

* @param actionStr
* @param scope
*/
public static void fireJsonAction(String actionStr, ServerEvent.Scope scope) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picky: this overload might be redundant because you only call it from fireAction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended. The idea is that you should be able to send an action to self(connId), user, channel, or world without having to create a target.

import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate and unused import

@@ -114,24 +116,39 @@ public void close() {
* @param type action type. Either "app_data.wsConnAdded" or "app_data.wsConnRemoved"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in javadoc: 'event though' -> 'even though'

if (!l.contains(q.getConnID())) l.add(q.getConnID());
});
FluxAction action = new FluxAction(type, connInfo);
ServerEventManager.fireAction(action, new ServerEvent.EventTarget(ServerEvent.Scope.SELF, seq.getConnID(), null, null));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: So each client on the same channel will be notified of every new or closed connection? Why do we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done to support JS external viewer and python API(?). I am guessing this information may be useful in the future as well.

@loitly
Copy link
Contributor Author

loitly commented Nov 16, 2016

Good catch in regard to email sync. It's fixed in the latest commit. As for email not sent, it will be fixed in DM-8182. Thank you for the review.

@loitly loitly merged commit 6df7588 into dev Nov 17, 2016
@loitly loitly deleted the DM-8179_background_jobs_server_side branch November 17, 2016 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants