-
Notifications
You must be signed in to change notification settings - Fork 66
feat: 2.10 nexus support #2965
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
base: develop
Are you sure you want to change the base?
feat: 2.10 nexus support #2965
Conversation
917fe5a to
1f5765d
Compare
e329643 to
096f6cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 files reviewed, 1 comment
Should we also provide a way to switch back with the CLI? |
|
|
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/config/loader.pyLines 65-78 65 )
66
67 # Re-read the newly created config
68 return self._read_toml(config_path)
! 69 except Exception as exc:
! 70 log.warning(
71 f"Failed to auto-migrate legacy configuration: {exc}. "
72 "Using legacy data without migration."
73 )
! 74 return legacy
75
76 if legacy:
77 return legacy
78 return {}tidy3d/web/cli/app.pyLines 102-110 102 Whether to verify SSL certificates
103 enable_caching : bool
104 Whether to enable result caching
105 """
! 106 configure_fn(
107 apikey,
108 nexus_url,
109 api_endpoint,
110 website_endpoint,Lines 217-225 217 if website_endpoint:
218 web_updates["website_endpoint"] = website_endpoint
219
220 if s3_region is not None:
! 221 web_updates["s3_region"] = s3_region
222
223 if ssl_verify is not None:
224 web_updates["ssl_verify"] = ssl_verifyLines 236-245 236 if apikey:
237
238 def auth(req: requests.Request) -> requests.Request:
239 """Enrich auth information to request."""
! 240 req.headers[HEADER_APIKEY] = apikey
! 241 return req
242
243 # Determine validation endpoint
244 validation_endpoint = api_endpoint if api_endpoint else str(config.web.api_endpoint)
245 validation_ssl = ssl_verify if ssl_verify is not None else config.web.ssl_verifyLines 247-256 247 target_url = f"{validation_endpoint.rstrip('/')}/apikey"
248
249 try:
250 resp = requests.get(target_url, auth=auth, verify=validation_ssl)
! 251 except (requests.exceptions.SSLError, ssl.SSLError):
! 252 resp = requests.get(target_url, auth=auth, verify=False)
253
254 if resp.status_code != 200:
255 click.echo(
256 f"Error: API key validation failed against endpoint: {validation_endpoint}\n"Lines 274-283 274 config.update_section("web", **nexus_updates)
275 config.save()
276 else:
277 # Non-nexus config: save everything to base config
! 278 config.update_section("web", **web_updates)
! 279 config.save()
280
281 if has_nexus_config:
282 # Set nexus as the default profile when nexus is configured
283 config.set_default_profile("nexus")Lines 292-302 292 "\nDefault profile set to 'nexus'. Tidy3D will now use these endpoints by default."
293 )
294 click.echo("To switch back to production, run: tidy3d configure --restore-defaults")
295 else:
! 296 click.echo("Configuration saved successfully.")
! 297 elif not apikey and not has_nexus_config:
! 298 click.echo("No configuration changes to apply.")
299
300
301 @click.command()
302 @click.argument("lsf_file") |
928e482 to
f52762d
Compare
yaugenst-flex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @daquinteroflex overall LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a message in e.g. ConfigManager.__init__() after profile resolution with something like
if self._profile != "default":
log.info(f"Using configuration profile: '{self._profile}'", log_once=True)to make sure users are aware if they're using a non-default profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I forgot, thanks
f52762d to
1ac42a1
Compare
1ac42a1 to
f5e200a
Compare
Seems to be working fine.
Greptile Overview
Greptile Summary
This PR adds Nexus on-premises server support for Tidy3D, enabling enterprise customers to connect to custom deployments.
Key changes:
configurecommand with--nexus-url,--api-endpoint,--website-endpoint,--s3-region,--s3-endpoint, and SSL/caching flagsdefault_profilepersistence toconfig.tomlso Nexus configuration persists across sessionsweb_api_endpoint,s3_endpoint, etc.)web.env_varsfor MinIO/S3-compatible storageArchitecture:
config.toml) stores API key anddefault_profilesettingprofiles/nexus.tomldefault_profile→ "default"Confidence Score: 4/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant User participant CLI as tidy3d CLI participant Config as ConfigManager participant Loader as ConfigLoader participant Profile as profiles/nexus.toml participant Base as config.toml participant S3Client as boto3 S3 Client User->>CLI: tidy3d configure --nexus-url CLI->>CLI: Derive endpoints from nexus_url CLI->>Config: update_section(web, apikey) Config->>Base: Save API key CLI->>Config: switch_profile(nexus) CLI->>Config: update_section(web, endpoints) Config->>Profile: Save nexus-specific settings CLI->>Config: set_default_profile(nexus) Config->>Loader: set_default_profile(nexus) Loader->>Base: Write default_profile Note over User,S3Client: On next session User->>Config: import tidy3d Config->>Loader: init Loader->>Base: Read default_profile Loader-->>Config: profile is nexus Config->>Profile: Load nexus settings User->>S3Client: Upload or Download S3Client->>Config: Read web.env_vars S3Client->>S3Client: Configure endpoint_url from env_vars