Skip to content

Commit

Permalink
Merge pull request #208 from hrntsm/Fix/tab-optuna-dashboard-button
Browse files Browse the repository at this point in the history
Fix/tab optuna dashboard button
  • Loading branch information
hrntsm authored Dec 28, 2023
2 parents bfc2224 + 6147ade commit d55046b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ for new features.

### Changed

for changes in existing functionality.
- Tunny Python runtime environment location to [UserProfile]/.tunny_env
- Moved settings file location to [UserProfile]/.tunny_env
- Storage's default path to the desktop.
- Previously, it was in the same folder as the Tunny component .gha file.
- Default StudyName set to empty.
- If you don't input a name in Tunny UI, Optuna will automatically assign a StudyName.

### Deprecated

Expand All @@ -28,9 +33,8 @@ for now removed features.

### Fixed

for any bug fixes.

- The seed value of the sampler was not used.
- Failure to launch Optuna-Dashboard from tab.

### Security

Expand Down
13 changes: 5 additions & 8 deletions Tunny/UI/LoadingInstruction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Grasshopper.GUI.Canvas;
using Grasshopper.Kernel;

using Tunny.Handler;
using Tunny.Resources;
using Tunny.Settings;
using Tunny.Util;
Expand Down Expand Up @@ -85,10 +84,8 @@ private List<ToolStripMenuItem> TunnyMenuItems

private void OptunaDashboardToolStripMenuItem_Click(object sender, EventArgs e)
{
string componentFolder = Path.GetDirectoryName(Grasshopper.Instances.ComponentServer.FindObjectByName("Tunny", true, true).Location);

string pythonDirectory = PythonInstaller.GetEmbeddedPythonPath();
string dashboardPath = pythonDirectory + "/Scripts/optuna-dashboard.exe";
string pythonDirectory = Path.Combine(TunnyVariables.TunnyEnvPath, "python");
string dashboardPath = Path.Combine(pythonDirectory, "Scripts", "optuna-dashboard.exe");

if (!Directory.Exists(pythonDirectory) && !File.Exists(dashboardPath))
{
Expand All @@ -99,13 +96,13 @@ private void OptunaDashboardToolStripMenuItem_Click(object sender, EventArgs e)
}
else
{
RunOptunaDashboard(componentFolder, dashboardPath);
RunOptunaDashboard(dashboardPath);
}
}

private static void RunOptunaDashboard(string componentFolder, string dashboardPath)
private static void RunOptunaDashboard(string dashboardPath)
{
string settingsPath = componentFolder + @"\Settings.json";
string settingsPath = TunnyVariables.OptimizeSettingsPath;
string storagePath = string.Empty;
if (File.Exists(settingsPath))
{
Expand Down
2 changes: 1 addition & 1 deletion Tunny/Util/TunnyVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Tunny.Util
{
public static class TunnyVariables
{
public static string TunnyEnvPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + ".tunny_env");
public static string TunnyEnvPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".tunny_env");
public static string OptimizeSettingsPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".tunny_env", "settings.json");
}
}

0 comments on commit d55046b

Please sign in to comment.