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

Fix recover_offline error: replace deprecated count() with countDocum… #538

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion fireworks/core/launchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ def __init__(
raise ValueError("Must specify a database name when using a MongoDB URI string.")
self.db = self.connection[self.name]
else:
if not "socketTimeoutMS" in self.mongoclient_kwargs:
self.mongoclient_kwargs["socketTimeoutMS"] = MONGO_SOCKET_TIMEOUT_MS
self.connection = MongoClient(
self.host,
self.port,
socketTimeoutMS=MONGO_SOCKET_TIMEOUT_MS,
username=self.username,
password=self.password,
authSource=self.authsource,
Expand Down
21 changes: 19 additions & 2 deletions fireworks/flask_site/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ footer .navbar .nav {
.pull-up { margin-bottom: 30px;}

.fw-link {
border-bottom: 1px dotted;
margin-left: 10px;
border-bottom: 1px dotted; /* Dotted underline */
margin-left: 10px; /* Left margin */
}

.table td{
Expand Down Expand Up @@ -122,3 +122,20 @@ form.query button[type=submit] {
hr.myhrline{
margin:5px;
}

.wf-name strong {
display: inline-block;
max-width: 150px; /* Adjust maximum width as needed */
white-space: nowrap; /* Prevent text from wrapping */
overflow: hidden; /* Hide the overflowed part */
text-overflow: ellipsis; /* Show ellipsis for overflowed text */
vertical-align: bottom;
}

.wf-name {
text-decoration: none; /* Remove underline from the link */
}

.wf-name strong:hover {
cursor: pointer; /* Change cursor to pointer on hover */
}
7 changes: 4 additions & 3 deletions fireworks/flask_site/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@
<td>
<div class="row pull-down-sm">
<div class="span2">
<a href="/wf/{{ wf.id }}"><strong>{{ wf.name }}</strong></a>
<a href="/wf/{{ wf.id }}" class="wf-name" title="{{ wf.name }}">
<strong>{{ wf.name }}</strong>
</a>
</div>
<div class="span3">
<span class="label {{wf.state}}">{{wf.state}}</span>
<span class="pull-right">
ID: <a href="/wf/{{ wf.id }}">{{ wf.id }}</a>
</span>
</div>

</div>
<hr>
<div class="pull-up">
{% for fw in wf.fireworks %}
<div>
<small><a class="fw-link {{fw.state}}" href="/fw/{{ fw.fw_id }}">{{fw.name}}</a></small>
<small><a class="fw-link {{fw.state}}" href="/fw/{{ fw.fw_id }}" title="{{fw.name}}">{{fw.name}}</a></small>
</div>
{% endfor %}
</div>
Expand Down
9 changes: 8 additions & 1 deletion fireworks/scripts/lpad_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def recover_offline(args: Namespace) -> None:
recovered_fws = []

for launch in lp.offline_runs.find({"completed": False, "deprecated": False}, {"launch_id": 1, "fw_id": 1}):
if fworker_name and lp.launches.count({"launch_id": launch["launch_id"], "fworker.name": fworker_name}) == 0:
if fworker_name and lp.launches.count_documents({"launch_id": launch["launch_id"], "fworker.name": fworker_name}) == 0:
continue
fw = lp.recover_offline(launch["launch_id"], args.ignore_errors, args.print_errors)
if fw:
Expand Down Expand Up @@ -1415,9 +1415,16 @@ def lpad(argv: Sequence[str] | None = None) -> int:
recover_parser.set_defaults(func=recover_offline)

forget_parser = subparsers.add_parser("forget_offline", help="forget offline workflows")
forget_parser.add_argument(*fw_id_args, **fw_id_kwargs)
forget_parser.add_argument("-n", "--name", help="name")
forget_parser.add_argument(*state_args, **state_kwargs)
forget_parser.add_argument(*query_args, **query_kwargs)
forget_parser.add_argument(*launches_mode_args, **launches_mode_kwargs)
forget_parser.add_argument(
"--password",
help="Today's date, e.g. 2012-02-25. Password or positive response to "
f"input prompt required when modifying more than {PW_CHECK_NUM} entries.",
)
forget_parser.set_defaults(func=forget_offline)

# admin commands
Expand Down
2 changes: 1 addition & 1 deletion fireworks/user_objects/queue_adapters/common_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def get_njobs_in_queue(self, username=None):

# run qstat
qstat = Command(self._get_status_cmd(username))
p = qstat.run(timeout=self.timeout, shell=True)
p = qstat.run(timeout=self.timeout)

# parse the result
if p[0] == 0:
Expand Down