Browse Source

fix: prestartup_script.py

- don't forget prestartup_script's config isn't relies on manager_core. they are string not a bool...

improve: scanner.py - parallel github_stat scan
pull/678/head
Dr.Lt.Data 6 months ago
parent
commit
24a4152a9a
  1. 2144
      github-stats.json
  2. 2
      glob/manager_core.py
  3. 6
      prestartup_script.py
  4. 32
      scanner.py

2144
github-stats.json

File diff suppressed because it is too large Load Diff

2
glob/manager_core.py

@ -23,7 +23,7 @@ sys.path.append(glob_path)
import cm_global import cm_global
from manager_util import * from manager_util import *
version = [2, 32, 6] version = [2, 32, 7]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))

6
prestartup_script.py

@ -49,7 +49,7 @@ def check_file_logging():
config.read(config_path) config.read(config_path)
default_conf = config['default'] default_conf = config['default']
if 'file_logging' in default_conf and not default_conf['file_logging']: if 'file_logging' in default_conf and default_conf['file_logging'].lower() == 'false':
enable_file_logging = False enable_file_logging = False
except Exception: except Exception:
pass pass
@ -364,7 +364,7 @@ def check_bypass_ssl():
config.read(config_path) config.read(config_path)
default_conf = config['default'] default_conf = config['default']
if 'bypass_ssl' in default_conf and default_conf['bypass_ssl']: if 'bypass_ssl' in default_conf and default_conf['bypass_ssl'].lower() == 'true':
print(f"[ComfyUI-Manager] WARN: Unsafe - SSL verification bypass option is Enabled. (see ComfyUI-Manager/config.ini)") print(f"[ComfyUI-Manager] WARN: Unsafe - SSL verification bypass option is Enabled. (see ComfyUI-Manager/config.ini)")
ssl._create_default_https_context = ssl._create_unverified_context # SSL certificate error fix. ssl._create_default_https_context = ssl._create_unverified_context # SSL certificate error fix.
except Exception: except Exception:
@ -586,7 +586,7 @@ def check_windows_event_loop_policy():
config.read(config_path) config.read(config_path)
default_conf = config['default'] default_conf = config['default']
if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy']: if 'windows_selector_event_loop_policy' in default_conf and default_conf['windows_selector_event_loop_policy'].lower() == 'true':
try: try:
import asyncio import asyncio
import asyncio.windows_events import asyncio.windows_events

32
scanner.py

@ -291,22 +291,34 @@ def update_custom_nodes():
repo = g.get_repo(owner_repo) repo = g.get_repo(owner_repo)
last_update = repo.pushed_at.strftime("%Y-%m-%d %H:%M:%S") if repo.pushed_at else 'N/A' last_update = repo.pushed_at.strftime("%Y-%m-%d %H:%M:%S") if repo.pushed_at else 'N/A'
github_stats[url] = { item = {
"stars": repo.stargazers_count, "stars": repo.stargazers_count,
"last_update": last_update, "last_update": last_update,
"cached_time": datetime.datetime.now().timestamp(), "cached_time": datetime.datetime.now().timestamp(),
} }
with open(GITHUB_STATS_CACHE_FILENAME, 'w', encoding='utf-8') as file: return url, item
json.dump(github_stats, file, ensure_ascii=False, indent=4)
else: else:
print(f"\nInvalid URL format for GitHub repository: {url}\n") print(f"\nInvalid URL format for GitHub repository: {url}\n")
except Exception as e: except Exception as e:
print(f"\nERROR on {url}\n{e}") print(f"\nERROR on {url}\n{e}")
return None
# resolve unresolved urls # resolve unresolved urls
for url, title, preemptions, node_pattern in git_url_titles_preemptions: with concurrent.futures.ThreadPoolExecutor(11) as executor:
if url not in github_stats: futures = []
renew_stat(url) for url, title, preemptions, node_pattern in git_url_titles_preemptions:
if url not in github_stats:
futures.append(executor.submit(renew_stat, url))
for future in concurrent.futures.as_completed(futures):
url_item = future.result()
if url_item is not None:
url, item = url_item
github_stats[url] = item
with open('github-stats-cache.json', 'w', encoding='utf-8') as file:
json.dump(github_stats, file, ensure_ascii=False, indent=4)
# renew outdated cache # renew outdated cache
outdated_urls = [] outdated_urls = []
@ -326,11 +338,11 @@ def update_custom_nodes():
json.dump(github_stats, file, ensure_ascii=False, indent=4) json.dump(github_stats, file, ensure_ascii=False, indent=4)
print(f"Successfully written to {GITHUB_STATS_FILENAME}.") print(f"Successfully written to {GITHUB_STATS_FILENAME}.")
with concurrent.futures.ThreadPoolExecutor(11) as executor:
if not skip_stat_update:
executor.submit(process_git_stats, git_url_titles_preemptions) # One single thread for `process_git_stats()`. Runs concurrently with `process_git_url_title()`.
if not skip_stat_update:
process_git_stats(git_url_titles_preemptions)
with concurrent.futures.ThreadPoolExecutor(11) as executor:
for url, title, preemptions, node_pattern in git_url_titles_preemptions: for url, title, preemptions, node_pattern in git_url_titles_preemptions:
executor.submit(process_git_url_title, url, title, preemptions, node_pattern) executor.submit(process_git_url_title, url, title, preemptions, node_pattern)

Loading…
Cancel
Save