accli 2.0.1__tar.gz → 2.0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -141,10 +141,10 @@ Usage: accli [OPTIONS] COMMAND [ARGS]...
141
141
  1. Copy and paste certificates from `<control_services_backend>/certs/ca.crt` as
142
142
  `./certs/dev-backend.crt` and `<accelerator_service>/minio_certs/ca.crt` as
143
143
  `./certs/dev-minio-ca.crt`.
144
- 2. Run
144
+ 2. Run as Administrator
145
145
  ```
146
146
  cd scripts
147
- import_certs_certutil.ps1
147
+ .\import_certs_certutil.ps1
148
148
  ```
149
149
 
150
150
  ### 🛠 Build & Upload
@@ -97,10 +97,10 @@ Usage: accli [OPTIONS] COMMAND [ARGS]...
97
97
  1. Copy and paste certificates from `<control_services_backend>/certs/ca.crt` as
98
98
  `./certs/dev-backend.crt` and `<accelerator_service>/minio_certs/ca.crt` as
99
99
  `./certs/dev-minio-ca.crt`.
100
- 2. Run
100
+ 2. Run as Administrator
101
101
  ```
102
102
  cd scripts
103
- import_certs_certutil.ps1
103
+ .\import_certs_certutil.ps1
104
104
  ```
105
105
 
106
106
  ### 🛠 Build & Upload
@@ -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.0.1"
3
+ VERSION = "v2.0.3"
@@ -34,10 +34,16 @@ if (Get-Command Unregister-ScheduledTask -ErrorAction SilentlyContinue) {
34
34
  Write-Host "[OK] Scheduled Tasks removed." -ForegroundColor Green
35
35
 
36
36
  # 2. Delete Registry Policy Keys
37
- Write-Host "Removing registry policies (EnableLinkedConnections, AnonymousUid, AnonymousGid)..." -ForegroundColor Yellow
37
+ Write-Host "Removing registry policies (EnableLinkedConnections, AnonymousUid, AnonymousGid, Cache)..." -ForegroundColor Yellow
38
38
  Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLinkedConnections" -ErrorAction SilentlyContinue | Out-Null
39
39
  Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousUid" -ErrorAction SilentlyContinue | Out-Null
40
40
  Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "AnonymousGid" -ErrorAction SilentlyContinue | Out-Null
41
+ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "DisableCache" -ErrorAction SilentlyContinue | Out-Null
42
+ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "MaxDirCacheSize" -ErrorAction SilentlyContinue | Out-Null
43
+ Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Cache" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
44
+ Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users" -ErrorAction SilentlyContinue |
45
+ Where-Object { $_.PSChildName -like "S-1-5-*" } |
46
+ ForEach-Object { Remove-Item -Path "$($_.PSPath)\Cache" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null }
41
47
  Write-Host "[OK] Registry policies removed." -ForegroundColor Green
42
48
 
43
49
  # 3. Delete Config Folder & Helpers
@@ -631,6 +631,13 @@ def enable_windows_nfs_features():
631
631
  " if ($null -ne $valUid -and $valUid.AnonymousUid -eq 0 -and $null -ne $valGid -and $valGid.AnonymousGid -eq 0) { $anonEnabled = $true }\n"
632
632
  "}\n"
633
633
  "\n"
634
+ "$cacheEnabled = $false\n"
635
+ "$cachePath = 'HKLM:\\SOFTWARE\\Microsoft\\ClientForNFS\\CurrentVersion\\Users\\Default\\Cache'\n"
636
+ "if (Test-Path $cachePath) {\n"
637
+ " $valDelta = Get-ItemProperty -Path $cachePath -Name 'AttributeTimeDelta' -ErrorAction SilentlyContinue\n"
638
+ " if ($null -ne $valDelta -and $valDelta.AttributeTimeDelta -ge 1) { $cacheEnabled = $true }\n"
639
+ "}\n"
640
+ "\n"
634
641
  "$taskEnabled = $false\n"
635
642
  "if (Get-Command Get-ScheduledTask -ErrorAction SilentlyContinue) {\n"
636
643
  " $t = Get-ScheduledTask -TaskName 'accli-mount-nfs' -ErrorAction SilentlyContinue\n"
@@ -640,7 +647,7 @@ def enable_windows_nfs_features():
640
647
  " if ($LASTEXITCODE -eq 0) { $taskEnabled = $true }\n"
641
648
  "}\n"
642
649
  "\n"
643
- "Write-Output \"NFS:$nfsEnabled;REG:$regEnabled;ANON:$anonEnabled;TASK:$taskEnabled\""
650
+ "Write-Output \"NFS:$nfsEnabled;REG:$regEnabled;ANON:$anonEnabled;CACHE:$cacheEnabled;TASK:$taskEnabled\""
644
651
  )
645
652
 
646
653
  check_cmd = [
@@ -651,6 +658,7 @@ def enable_windows_nfs_features():
651
658
  nfs_ok = False
652
659
  reg_ok = False
653
660
  anon_ok = False
661
+ cache_ok = False
654
662
  task_ok = False
655
663
 
656
664
  try:
@@ -663,13 +671,15 @@ def enable_windows_nfs_features():
663
671
  reg_ok = (part.split(':')[1].lower() == 'true')
664
672
  elif part.startswith("ANON:"):
665
673
  anon_ok = (part.split(':')[1].lower() == 'true')
674
+ elif part.startswith("CACHE:"):
675
+ cache_ok = (part.split(':')[1].lower() == 'true')
666
676
  elif part.startswith("TASK:"):
667
677
  task_ok = (part.split(':')[1].lower() == 'true')
668
678
  except Exception as e:
669
679
  print(f"[yellow]Warning: Could not audit current Windows NFS settings: {e}[/yellow]")
670
680
 
671
- # Require both general registry settings and Anonymous mappings to be correct
672
- reg_ok = reg_ok and anon_ok
681
+ # Require general registry settings, Anonymous mappings, and Cache policies to be correct
682
+ reg_ok = reg_ok and anon_ok and cache_ok
673
683
 
674
684
  if nfs_ok and reg_ok and task_ok:
675
685
  print("[bold green][OK] Windows NFS client features, registry policies, and Task Scheduler gateway are already configured.[/bold green]")
@@ -75,6 +75,39 @@ if (-not $RegAlreadyEnabled) {
75
75
  Write-Host "[OK] Anonymous UID/GID registry values already configured (skipped)." -ForegroundColor Green
76
76
  }
77
77
 
78
+ # 2.6 Configure Client for NFS Cache (fast directory refresh without caching delay)
79
+ Write-Host "Configuring Client for NFS directory cache timeouts..." -ForegroundColor Cyan
80
+
81
+ # Global redirector controls:
82
+ # DisableCache = 0 allows file content caching in memory
83
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "DisableCache" -Value 0 -PropertyType DWORD -Force | Out-Null
84
+ # MaxDirCacheSize = 0 bypasses directory tree RAM cache so newly created/deleted files appear immediately
85
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" -Name "MaxDirCacheSize" -Value 0 -PropertyType DWORD -Force | Out-Null
86
+
87
+ $cacheTargets = @(
88
+ "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users\Default\Cache"
89
+ )
90
+
91
+ $existingUsers = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Users" -ErrorAction SilentlyContinue |
92
+ Where-Object { $_.PSChildName -like "S-1-5-*" }
93
+
94
+ foreach ($u in $existingUsers) {
95
+ $cacheTargets += "$($u.PSPath)\Cache"
96
+ }
97
+
98
+ foreach ($targetPath in $cacheTargets) {
99
+ if (-not (Test-Path $targetPath)) {
100
+ New-Item -Path $targetPath -Force | Out-Null
101
+ }
102
+ # Enable the attribute cache
103
+ New-ItemProperty -Path $targetPath -Name "FileAttributeCache" -Value 1 -PropertyType DWORD -Force | Out-Null
104
+ # AttributeTimeDelta: metadata TTL (10s) to align with --metadata-ttl-ms 10000
105
+ New-ItemProperty -Path $targetPath -Name "AttributeTimeDelta" -Value 10 -PropertyType DWORD -Force | Out-Null
106
+ # CacheRefreshInterval: file content cache TTL (10s) so modified files refresh within 10s
107
+ New-ItemProperty -Path $targetPath -Name "CacheRefreshInterval" -Value 10 -PropertyType DWORD -Force | Out-Null
108
+ }
109
+ Write-Host "[OK] Client for NFS balanced cache policy configured (10s TTL, No Dir Cache)." -ForegroundColor Green
110
+
78
111
  # 3. Create public ProgramData folder and configure permissions for Authenticated Users
79
112
  Write-Host "Initializing public accli configuration directory..." -ForegroundColor Cyan
80
113
  $configDir = "C:\ProgramData\accli"
@@ -126,7 +159,6 @@ try {
126
159
  }
127
160
  } catch {}
128
161
 
129
- # Construct arguments
130
162
  $mountArgs = @(
131
163
  "--token-file", $cfg.db_path,
132
164
  "--hub-endpoint", $cfg.server_url,
@@ -39,18 +39,25 @@ def get_db_path():
39
39
 
40
40
  def save_token_details(token, server_url, webcli_url):
41
41
  db_path = get_db_path()
42
-
43
- try:
44
- os.remove(db_path)
45
- except OSError:
46
- pass
47
-
48
42
  db = TinyDB(db_path)
49
- db.insert({
50
- 'token': token,
51
- 'server_url': server_url,
52
- 'webcli_url': webcli_url
53
- })
43
+
44
+ if len(db) > 0:
45
+ doc = next(iter(db))
46
+ doc_id = doc.doc_id
47
+ db.update({
48
+ 'token': token,
49
+ 'server_url': server_url,
50
+ 'webcli_url': webcli_url
51
+ }, doc_ids=[doc_id])
52
+ for extra in list(db):
53
+ if extra.doc_id != doc_id:
54
+ db.remove(doc_ids=[extra.doc_id])
55
+ else:
56
+ db.insert({
57
+ 'token': token,
58
+ 'server_url': server_url,
59
+ 'webcli_url': webcli_url
60
+ })
54
61
 
55
62
 
56
63
  def get_token():
@@ -154,13 +161,21 @@ def get_github_app_token():
154
161
  def set_github_app_token(github_app_token):
155
162
  db_path = get_db_path()
156
163
  db = TinyDB(db_path)
157
- db.update({'github_app_token': github_app_token}, doc_ids=[1])
164
+ if len(db) > 0:
165
+ doc = next(iter(db))
166
+ db.update({'github_app_token': github_app_token}, doc_ids=[doc.doc_id])
167
+ else:
168
+ db.insert({'github_app_token': github_app_token})
158
169
 
159
170
 
160
171
  def set_project_slug(project_slug):
161
172
  db_path = get_db_path()
162
173
  db = TinyDB(db_path)
163
- db.update({'project_slug': project_slug}, doc_ids=[1])
174
+ if len(db) > 0:
175
+ doc = next(iter(db))
176
+ db.update({'project_slug': project_slug}, doc_ids=[doc.doc_id])
177
+ else:
178
+ db.insert({'project_slug': project_slug})
164
179
 
165
180
 
166
181
  def get_project_slug():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: accli
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: IIASA Accelerator Client
5
5
  Author-email: Wrufesh S <wrufesh@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -141,10 +141,10 @@ Usage: accli [OPTIONS] COMMAND [ARGS]...
141
141
  1. Copy and paste certificates from `<control_services_backend>/certs/ca.crt` as
142
142
  `./certs/dev-backend.crt` and `<accelerator_service>/minio_certs/ca.crt` as
143
143
  `./certs/dev-minio-ca.crt`.
144
- 2. Run
144
+ 2. Run as Administrator
145
145
  ```
146
146
  cd scripts
147
- import_certs_certutil.ps1
147
+ .\import_certs_certutil.ps1
148
148
  ```
149
149
 
150
150
  ### 🛠 Build & Upload
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