accli 2.1.2__tar.gz → 2.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {accli-2.1.2 → accli-2.1.4}/PKG-INFO +1 -1
  2. {accli-2.1.2 → accli-2.1.4}/accli/_version.py +1 -1
  3. accli-2.1.4/accli/acc_logo.ico +0 -0
  4. accli-2.1.4/accli/acc_logo.png +0 -0
  5. {accli-2.1.2 → accli-2.1.4}/accli/cli.py +37 -10
  6. {accli-2.1.2 → accli-2.1.4}/accli/gui.py +89 -7
  7. {accli-2.1.2 → accli-2.1.4}/accli/setup-nfs.ps1 +11 -5
  8. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/PKG-INFO +1 -1
  9. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/SOURCES.txt +2 -0
  10. {accli-2.1.2 → accli-2.1.4}/pyproject.toml +1 -1
  11. {accli-2.1.2 → accli-2.1.4}/LICENSE +0 -0
  12. {accli-2.1.2 → accli-2.1.4}/README.md +0 -0
  13. {accli-2.1.2 → accli-2.1.4}/accli/AcceleratorJobProjectService.py +0 -0
  14. {accli-2.1.2 → accli-2.1.4}/accli/AcceleratorTaskDispatcher.py +0 -0
  15. {accli-2.1.2 → accli-2.1.4}/accli/AcceleratorTerminalCliProjectService.py +0 -0
  16. {accli-2.1.2 → accli-2.1.4}/accli/CsvRegionalTimeseriesValidator.py +0 -0
  17. {accli-2.1.2 → accli-2.1.4}/accli/__init__.py +0 -0
  18. {accli-2.1.2 → accli-2.1.4}/accli/__main__.py +0 -0
  19. {accli-2.1.2 → accli-2.1.4}/accli/cleanup-nfs.ps1 +0 -0
  20. {accli-2.1.2 → accli-2.1.4}/accli/common.py +0 -0
  21. {accli-2.1.2 → accli-2.1.4}/accli/job_views.py +0 -0
  22. {accli-2.1.2 → accli-2.1.4}/accli/log_timeline.py +0 -0
  23. {accli-2.1.2 → accli-2.1.4}/accli/mount_downloader.py +0 -0
  24. {accli-2.1.2 → accli-2.1.4}/accli/nfs_watcher.py +0 -0
  25. {accli-2.1.2 → accli-2.1.4}/accli/refresh_explorer.ps1 +0 -0
  26. {accli-2.1.2 → accli-2.1.4}/accli/token.py +0 -0
  27. {accli-2.1.2 → accli-2.1.4}/accli/version_checker.py +0 -0
  28. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/dependency_links.txt +0 -0
  29. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/entry_points.txt +0 -0
  30. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/requires.txt +0 -0
  31. {accli-2.1.2 → accli-2.1.4}/accli.egg-info/top_level.txt +0 -0
  32. {accli-2.1.2 → accli-2.1.4}/setup.cfg +0 -0
  33. {accli-2.1.2 → accli-2.1.4}/tests/test_jobs_commands.py +0 -0
  34. {accli-2.1.2 → accli-2.1.4}/tests/test_log_timeline.py +0 -0
  35. {accli-2.1.2 → accli-2.1.4}/tests/test_logs_command.py +0 -0
  36. {accli-2.1.2 → accli-2.1.4}/tests/test_mount_lifecycle.py +0 -0
  37. {accli-2.1.2 → accli-2.1.4}/tests/test_update_check.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -1,3 +1,3 @@
1
1
  # Please strictly put double quote to use this info for git tag
2
2
  # Read a developer guide for git tag command with regex
3
- VERSION = "v2.1.2"
3
+ VERSION = "v2.1.4"
Binary file
Binary file
@@ -1093,6 +1093,14 @@ def map_windows_network_drive(mount_point_abs, max_attempts: int) -> tuple[bool,
1093
1093
  for attempt in range(1, max_attempts + 1):
1094
1094
  cleanup_stuck_windows_mount_processes()
1095
1095
 
1096
+ # Ensure any prior accli-umount-nfs task has finished and NfsClnt is RUNNING (prevents Network Error - 1222)
1097
+ for _ in range(10):
1098
+ umount_check = subprocess.run(["schtasks", "/query", "/tn", "accli-umount-nfs"], capture_output=True, text=True, errors="replace")
1099
+ clnt_check = subprocess.run(["sc.exe", "query", "NfsClnt"], capture_output=True, text=True, errors="replace")
1100
+ if (not umount_check.stdout or "Running" not in umount_check.stdout) and (clnt_check.stdout and "RUNNING" in clnt_check.stdout):
1101
+ break
1102
+ time.sleep(0.5)
1103
+
1096
1104
  # If daemon died before or between attempts, revive it
1097
1105
  if not is_nfs_daemon_running():
1098
1106
  subprocess.run(["schtasks", "/run", "/tn", "accli-mount-nfs"], capture_output=True)
@@ -1234,21 +1242,38 @@ def enable_windows_nfs_features():
1234
1242
  reg_ok = reg_ok and anon_ok and cache_ok
1235
1243
 
1236
1244
  if nfs_ok and reg_ok and task_ok:
1237
- # Ensure run-umount-helper.ps1 includes the NfsRdr/NfsClnt kernel cache flush
1245
+ # Ensure run-umount-helper.ps1 includes fast nfsclnt termination and NfsRdr/NfsClnt kernel cache flush
1238
1246
  try:
1239
1247
  umount_helper = Path("C:/ProgramData/accli/run-umount-helper.ps1")
1240
1248
  if umount_helper.is_file():
1241
1249
  content = umount_helper.read_text(encoding="utf-8", errors="ignore")
1242
- if "Stop-Service -Name \"NfsRdr\"" not in content:
1250
+ if 'Stop-Process -Name "nfsclnt"' not in content:
1243
1251
  umount_helper.write_text(
1244
- content.rstrip()
1245
- + "\n\n# Synchronously stop NfsClnt & NfsRdr, then start NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache\n"
1246
- + "try {\n"
1247
- + " Stop-Service -Name \"NfsClnt\" -Force -ErrorAction SilentlyContinue\n"
1248
- + " Stop-Service -Name \"NfsRdr\" -Force -ErrorAction SilentlyContinue\n"
1249
- + " Start-Service -Name \"NfsRdr\" -ErrorAction SilentlyContinue\n"
1250
- + " Start-Service -Name \"NfsClnt\" -ErrorAction SilentlyContinue\n"
1251
- + "} catch {}\n",
1252
+ 'try {\n'
1253
+ ' if (Get-Command Stop-ScheduledTask -ErrorAction SilentlyContinue) {\n'
1254
+ ' Stop-ScheduledTask -TaskName "accli-mount-nfs" -ErrorAction SilentlyContinue | Out-Null\n'
1255
+ ' } else {\n'
1256
+ ' schtasks /end /tn "accli-mount-nfs" 2> $null | Out-Null\n'
1257
+ ' }\n'
1258
+ '} catch {}\n\n'
1259
+ 'try {\n'
1260
+ ' Get-CimInstance Win32_Process -Filter "name=\'hf-mount-nfs.exe\'" | ForEach-Object {\n'
1261
+ ' Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue | Out-Null\n'
1262
+ ' }\n'
1263
+ '} catch {}\n\n'
1264
+ '# Force-kill nfsclnt.exe so NfsClnt never hangs in STOP_PENDING, then cycle NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache\n'
1265
+ 'try {\n'
1266
+ ' Stop-Process -Name "nfsclnt" -Force -ErrorAction SilentlyContinue | Out-Null\n'
1267
+ ' Stop-Service -Name "NfsClnt" -Force -ErrorAction SilentlyContinue | Out-Null\n'
1268
+ ' Stop-Service -Name "NfsRdr" -Force -ErrorAction SilentlyContinue | Out-Null\n'
1269
+ ' Start-Service -Name "NfsRdr" -ErrorAction SilentlyContinue | Out-Null\n'
1270
+ ' for ($i = 0; $i -lt 5; $i++) {\n'
1271
+ ' $svc = Get-Service -Name "NfsClnt" -ErrorAction SilentlyContinue\n'
1272
+ ' if ($svc -and $svc.Status -eq \'Running\') { break }\n'
1273
+ ' Start-Service -Name "NfsClnt" -ErrorAction SilentlyContinue | Out-Null\n'
1274
+ ' Start-Sleep -Milliseconds 500\n'
1275
+ ' }\n'
1276
+ '} catch {}\n',
1252
1277
  encoding="utf-8",
1253
1278
  )
1254
1279
  except Exception:
@@ -1582,6 +1607,8 @@ def mount_start(
1582
1607
  print(f"[bold red][ERROR] NFS daemon started, but failed to map drive {mount_point_abs} in user session.[/bold red]")
1583
1608
  if err_msg:
1584
1609
  print(f"[red]{err_msg}[/red]")
1610
+ # Clean up the spawned daemon so a failed mount does not leave a zombie daemon running
1611
+ subprocess.run(["schtasks", "/run", "/tn", "accli-umount-nfs"], capture_output=True)
1585
1612
  print("[yellow]Tip: Make sure Windows NFS client feature was fully enabled and the PC was restarted.[/yellow]")
1586
1613
  raise typer.Exit(1)
1587
1614
  else:
@@ -5,6 +5,7 @@ import time
5
5
  import platform
6
6
  import threading
7
7
  import subprocess
8
+ import webbrowser
8
9
  from pathlib import Path
9
10
 
10
11
  def setup_tcl_tk_env():
@@ -33,7 +34,7 @@ from tkinter import ttk, messagebox, filedialog
33
34
 
34
35
  # Ensure PyInstaller static analyzer traces and bundles all CLI dependencies
35
36
  import accli.cli
36
- from accli.version_checker import check_for_updates, get_upgrade_instruction
37
+ from accli.version_checker import RELEASES_URL, check_for_updates, get_upgrade_instruction
37
38
  from accli._version import VERSION
38
39
 
39
40
  class AccliGuiApp(tk.Tk):
@@ -42,6 +43,7 @@ class AccliGuiApp(tk.Tk):
42
43
  self.title("IIASA Accelerator Client (accli)")
43
44
  self.geometry("800x600")
44
45
  self.minsize(700, 500)
46
+ self.set_app_icon()
45
47
 
46
48
  # Apply dark modern theme style
47
49
  self.style = ttk.Style()
@@ -54,6 +56,17 @@ class AccliGuiApp(tk.Tk):
54
56
  self.refresh_login_status()
55
57
  self.refresh_mounts_list()
56
58
  self.check_version_async()
59
+
60
+ def set_app_icon(self):
61
+ base_dir = Path(getattr(sys, "_MEIPASS", Path(__file__).parent))
62
+ for candidate in (Path(__file__).parent / "acc_logo.png", base_dir / "accli" / "acc_logo.png", base_dir / "acc_logo.png"):
63
+ if candidate.is_file():
64
+ try:
65
+ self._app_icon = tk.PhotoImage(file=str(candidate))
66
+ self.iconphoto(True, self._app_icon)
67
+ break
68
+ except Exception:
69
+ pass
57
70
 
58
71
  def configure_styles(self):
59
72
  self.configure(bg="#1e1e1e")
@@ -128,14 +141,77 @@ class AccliGuiApp(tk.Tk):
128
141
  def show_notice():
129
142
  self.status_bar_val.set(f"Update available: accli {latest} (current: {VERSION})")
130
143
  self.append_log(f"\n🔔 Update available: accli {latest} (current: {VERSION})\n{instruction}\n\n")
131
- # Also show subtle info notification
132
- messagebox.showinfo(
133
- "Update Available",
134
- f"Update available: accli {latest} (current: {VERSION})\n\n{instruction}"
135
- )
144
+ self.show_update_dialog(latest, instruction)
136
145
  self.after(0, show_notice)
137
146
  threading.Thread(target=worker, daemon=True).start()
138
147
 
148
+ def show_update_dialog(self, latest: str, instruction: str):
149
+ dialog = tk.Toplevel(self)
150
+ dialog.title("Update Available")
151
+ dialog.configure(bg="#1e1e1e")
152
+ dialog.resizable(False, False)
153
+ dialog.transient(self)
154
+
155
+ frame = ttk.Frame(dialog, padding=20)
156
+ frame.pack(fill=tk.BOTH, expand=True)
157
+
158
+ ttk.Label(
159
+ frame,
160
+ text=f"Update available: accli {latest} (current: {VERSION})",
161
+ font=("Segoe UI", 11, "bold"),
162
+ ).pack(anchor=tk.W, pady=(0, 10))
163
+
164
+ if RELEASES_URL in instruction:
165
+ prompt_text = "Download the latest release from:"
166
+ copy_value = RELEASES_URL
167
+ else:
168
+ prompt_text = instruction
169
+ copy_value = "pip install -U accli"
170
+
171
+ ttk.Label(frame, text=prompt_text).pack(anchor=tk.W, pady=(0, 5))
172
+
173
+ link_var = tk.StringVar(value=copy_value)
174
+ link_entry = tk.Entry(
175
+ frame,
176
+ textvariable=link_var,
177
+ state="readonly",
178
+ readonlybackground="#2d2d2d",
179
+ fg="#4ec9b0",
180
+ relief=tk.FLAT,
181
+ font=("Segoe UI", 10),
182
+ width=58,
183
+ )
184
+ link_entry.pack(fill=tk.X, pady=(0, 15), ipady=4)
185
+ link_entry.selection_range(0, tk.END)
186
+
187
+ btn_frame = ttk.Frame(frame)
188
+ btn_frame.pack(fill=tk.X)
189
+
190
+ def copy_to_clipboard():
191
+ self.clipboard_clear()
192
+ self.clipboard_append(copy_value)
193
+ self.update()
194
+ copy_btn.configure(text="Copied!")
195
+ dialog.after(1500, lambda: copy_btn.configure(text="Copy Link" if RELEASES_URL in instruction else "Copy"))
196
+
197
+ copy_btn = ttk.Button(
198
+ btn_frame,
199
+ text="Copy Link" if RELEASES_URL in instruction else "Copy",
200
+ command=copy_to_clipboard,
201
+ )
202
+ copy_btn.pack(side=tk.LEFT, padx=(0, 8))
203
+
204
+ if RELEASES_URL in instruction:
205
+ open_btn = ttk.Button(
206
+ btn_frame,
207
+ text="Open in Browser",
208
+ command=lambda: webbrowser.open(RELEASES_URL),
209
+ )
210
+ open_btn.pack(side=tk.LEFT, padx=(0, 8))
211
+
212
+ ok_btn = ttk.Button(btn_frame, text="OK", style="Refresh.TButton", command=dialog.destroy)
213
+ ok_btn.pack(side=tk.RIGHT)
214
+
139
215
  def run_cli_async(self, args, on_done=None, log_to_viewer=True, elevate=False):
140
216
  """Runs the CLI binary in a background thread to prevent UI freezing."""
141
217
  def worker():
@@ -164,14 +240,20 @@ class AccliGuiApp(tk.Tk):
164
240
  startupinfo = subprocess.STARTUPINFO()
165
241
  startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
166
242
 
243
+ env = os.environ.copy()
244
+ env["PYTHONIOENCODING"] = "utf-8"
245
+ env["PYTHONUTF8"] = "1"
246
+
167
247
  process = subprocess.Popen(
168
248
  cmd,
169
249
  stdout=subprocess.PIPE,
170
250
  stderr=subprocess.STDOUT,
171
251
  text=True,
252
+ encoding="utf-8",
172
253
  errors="replace",
173
254
  bufsize=1,
174
- startupinfo=startupinfo
255
+ startupinfo=startupinfo,
256
+ env=env,
175
257
  )
176
258
 
177
259
  output_lines = []
@@ -222,12 +222,18 @@ try {
222
222
  }
223
223
  } catch {}
224
224
 
225
- # Synchronously stop NfsClnt & NfsRdr, then start NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache
225
+ # Force-kill nfsclnt.exe so NfsClnt never hangs in STOP_PENDING, then cycle NfsRdr & NfsClnt to flush stale kernel V_NET_ROOT cache
226
226
  try {
227
- Stop-Service -Name "NfsClnt" -Force -ErrorAction SilentlyContinue
228
- Stop-Service -Name "NfsRdr" -Force -ErrorAction SilentlyContinue
229
- Start-Service -Name "NfsRdr" -ErrorAction SilentlyContinue
230
- Start-Service -Name "NfsClnt" -ErrorAction SilentlyContinue
227
+ Stop-Process -Name "nfsclnt" -Force -ErrorAction SilentlyContinue | Out-Null
228
+ Stop-Service -Name "NfsClnt" -Force -ErrorAction SilentlyContinue | Out-Null
229
+ Stop-Service -Name "NfsRdr" -Force -ErrorAction SilentlyContinue | Out-Null
230
+ Start-Service -Name "NfsRdr" -ErrorAction SilentlyContinue | Out-Null
231
+ for ($i = 0; $i -lt 5; $i++) {
232
+ $svc = Get-Service -Name "NfsClnt" -ErrorAction SilentlyContinue
233
+ if ($svc -and $svc.Status -eq 'Running') { break }
234
+ Start-Service -Name "NfsClnt" -ErrorAction SilentlyContinue | Out-Null
235
+ Start-Sleep -Milliseconds 500
236
+ }
231
237
  } catch {}
232
238
  '@
233
239
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -8,6 +8,8 @@ accli/CsvRegionalTimeseriesValidator.py
8
8
  accli/__init__.py
9
9
  accli/__main__.py
10
10
  accli/_version.py
11
+ accli/acc_logo.ico
12
+ accli/acc_logo.png
11
13
  accli/cleanup-nfs.ps1
12
14
  accli/cli.py
13
15
  accli/common.py
@@ -32,7 +32,7 @@ classifiers = [
32
32
  packages = ['accli']
33
33
 
34
34
  [tool.setuptools.package-data]
35
- accli = ["*.ps1"]
35
+ accli = ["*.ps1", "*.png", "*.ico"]
36
36
 
37
37
  [tool.setuptools.dynamic]
38
38
  version = {attr="accli._version.VERSION"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes