Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Print instruction after teardown #403

Merged
merged 6 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ sphinx-material
sphinx-code-include
sphinx-copybutton
sphinx_fontawesome
sphinxcontrib-yt
sphinxcontrib-youtube
sphinx-panels
2 changes: 1 addition & 1 deletion doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sphinxcontrib-yt==0.2.2
sphinxcontrib-youtube==1.2.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this manually. I was not able to do make doc-requirements.txt because pip-compile complained:

Using legacy resolver. Consider using backtracking resolver with `--resolver=backtracking`.
Could not find a version that matches sphinx<5,<8.0.0,>=0.6,>=1.3,>=1.5.0,>=1.8,>=2,>=7.0.0,~=4.0 (from -r doc-requirements.in (line 2))
Tried: 0.1.61611, 0.1.61798, 0.1.61843, 0.1.61945, 0.1.61950, 0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.5, 0.5.1, 0.5.2, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 1.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.1, 1.1.1, 1.1.2, 1.1.3, 1.2, 1.2, 1.2, 1.2.1, 1.2.1, 1.2.1, 1.2.2, 1.2.2, 1.2.2, 1.2.3, 1.2.3, 1.3, 1.3, 1.3.1, 1.3.1, 1.3.2, 1.3.2, 1.3.3, 1.3.3, 1.3.4,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ependencies:
  sphinx (from -r doc-requirements.in (line 2))
  Sphinx<8.0.0,>=7.0.0 (from sphinx-prompt==1.7.0->-r doc-requirements.in (line 3))
  Sphinx>=0.6 (from sphinxcontrib-youtube==1.2.0->-r doc-requirements.in (line 8))
  sphinx~=4.0 (from furo==2022.4.7.dev1->-r doc-requirements.in (line 1))
  sphinx<5,>=2 (from sphinx-panels==0.6.0->-r doc-requirements.in (line 9))
  Sphinx>=1.5.0 (from sphinx_fontawesome==0.0.6->-r doc-requirements.in (line 7))
  sphinx>=1.3 (from sphinx-code-include==1.1.1->-r doc-requirements.in (line 5))
  sphinx>=2.0 (from sphinx-material==0.0.35->-r doc-requirements.in (line 4))
  sphinx>=1.8 (from sphinx-copybutton==0.5.2->-r doc-requirements.in (line 6))
make: *** [doc-requirements.txt] Error 2

So sphinx-panels and sphinx-prompt don't agree with each other.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# via -r doc-requirements.in
text-unidecode==1.3
# via python-slugify
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"sphinx-prompt",
"sphinx_copybutton",
"sphinx_fontawesome",
"sphinxcontrib.yt",
"sphinxcontrib.youtube",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sphinxcontrib-youtube vs. sphinxcontrib.youtube, lol.

"sphinx_panels",
]

Expand Down
6 changes: 3 additions & 3 deletions pkg/sandbox/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func startSandbox(ctx context.Context, cli docker.Docker, g github.GHRepoService
return nil, err
}
fmt.Printf("Existing details of your sandbox")
util.PrintSandboxMessage(consolePort, docker.Kubeconfig, sandboxConfig.DryRun)
util.PrintSandboxStartMessage(consolePort, docker.Kubeconfig, sandboxConfig.DryRun)
return nil, nil
}
}
Expand Down Expand Up @@ -429,7 +429,7 @@ func StartDemoCluster(ctx context.Context, args []string, sandboxConfig *sandbox
if err != nil {
return err
}
util.PrintDemoMessage(util.DemoConsolePort, docker.Kubeconfig, sandboxConfig.DryRun)
util.PrintDemoStartMessage(util.DemoConsolePort, docker.Kubeconfig, sandboxConfig.DryRun)
return nil
}

Expand All @@ -444,6 +444,6 @@ func StartSandboxCluster(ctx context.Context, args []string, sandboxConfig *sand
if err != nil {
return err
}
util.PrintSandboxMessage(util.SandBoxConsolePort, docker.SandboxKubeconfig, sandboxConfig.DryRun)
util.PrintSandboxStartMessage(util.SandBoxConsolePort, docker.SandboxKubeconfig, sandboxConfig.DryRun)
return nil
}
2 changes: 2 additions & 0 deletions pkg/sandbox/teardown.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/flyteorg/flytectl/pkg/configutil"
"github.com/flyteorg/flytectl/pkg/docker"
"github.com/flyteorg/flytectl/pkg/k8s"
"github.com/flyteorg/flytectl/pkg/util"
)

func Teardown(ctx context.Context, cli docker.Docker, teardownFlags *sandboxCmdConfig.TeardownFlags) error {
Expand Down Expand Up @@ -38,6 +39,7 @@ func Teardown(ctx context.Context, cli docker.Docker, teardownFlags *sandboxCmdC
}

fmt.Printf("%v %v Sandbox cluster is removed successfully.\n", emoji.Broom, emoji.Broom)
util.PrintSandboxTeardownMessage(util.SandBoxConsolePort, docker.SandboxKubeconfig)
return nil
}

Expand Down
18 changes: 11 additions & 7 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func SetupFlyteDir() error {
return nil
}

// PrintDemoMessage will print sandbox success message
func PrintDemoMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bool) {
// PrintDemoStartMessage will print demo start success message
func PrintDemoStartMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bool) {
kubeconfig := strings.Join([]string{
"$KUBECONFIG",
kubeconfigLocation,
Expand All @@ -84,10 +84,9 @@ func PrintDemoMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bo
successMsg = fmt.Sprintf("%v http://localhost:%v/console", ProgressSuccessMessagePending, flyteConsolePort)
} else {
successMsg = fmt.Sprintf("%v http://localhost:%v/console", ProgressSuccessMessage, flyteConsolePort)

}
fmt.Printf("%v %v %v %v %v \n", emoji.ManTechnologist, successMsg, emoji.Rocket, emoji.Rocket, emoji.PartyPopper)
fmt.Printf("%v Run the following command to export sandbox environment variables for accessing flytectl\n", emoji.Sparkle)
fmt.Printf("%v Run the following command to export demo environment variables for accessing flytectl\n", emoji.Sparkle)
fmt.Printf(" export FLYTECTL_CONFIG=%v \n", configutil.FlytectlConfig)
if dryRun {
fmt.Printf("%v Run the following command to export kubeconfig variables for accessing flyte pods locally\n", emoji.Sparkle)
Expand All @@ -97,8 +96,8 @@ func PrintDemoMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bo
fmt.Printf("%s The Minio API is hosted on localhost:30002. Use http://localhost:30080/minio/login for Minio console\n", emoji.OpenFileFolder)
}

// PrintSandboxMessage will print sandbox success message
func PrintSandboxMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bool) {
// PrintSandboxStartMessage will print sandbox start success message
func PrintSandboxStartMessage(flyteConsolePort int, kubeconfigLocation string, dryRun bool) {
kubeconfig := strings.Join([]string{
"$KUBECONFIG",
kubeconfigLocation,
Expand All @@ -109,7 +108,6 @@ func PrintSandboxMessage(flyteConsolePort int, kubeconfigLocation string, dryRun
successMsg = fmt.Sprintf("%v http://localhost:%v/console", ProgressSuccessMessagePending, flyteConsolePort)
} else {
successMsg = fmt.Sprintf("%v http://localhost:%v/console", ProgressSuccessMessage, flyteConsolePort)

}
fmt.Printf("%v %v %v %v %v \n", emoji.ManTechnologist, successMsg, emoji.Rocket, emoji.Rocket, emoji.PartyPopper)
fmt.Printf("%v Run the following command to export sandbox environment variables for accessing flytectl\n", emoji.Sparkle)
Expand All @@ -120,6 +118,12 @@ func PrintSandboxMessage(flyteConsolePort int, kubeconfigLocation string, dryRun
}
}

// PrintSandboxTeardownMessage will print sandbox teardown success message
func PrintSandboxTeardownMessage(flyteConsolePort int, kubeconfigLocation string) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we don't need an equivalent for demo command because demo teardown invokes sandbox.Teardown()

fmt.Printf("%v Run the following command to unset sandbox environment variables for accessing flytectl\n", emoji.Sparkle)
fmt.Printf(" unset FLYTECTL_CONFIG \n")
}

// SendRequest will create request and return the response
func SendRequest(method, url string, option io.Reader) (*http.Response, error) {
client := &http.Client{}
Expand Down
10 changes: 8 additions & 2 deletions pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ func TestSetupFlyteDir(t *testing.T) {
assert.Nil(t, SetupFlyteDir())
}

func TestPrintSandboxMessage(t *testing.T) {
func TestPrintSandboxStartMessage(t *testing.T) {
t.Run("Print Sandbox Message", func(t *testing.T) {
PrintSandboxMessage(SandBoxConsolePort, docker.SandboxKubeconfig, false)
PrintSandboxStartMessage(SandBoxConsolePort, docker.SandboxKubeconfig, false)
})
}

func TestPrintSandboxTeardownMessage(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't seem to be very useful, so just for the completeness.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in all honesty, the previous test is not terribly useful either. It's fine to leave both there.

t.Run("Print Sandbox Message", func(t *testing.T) {
PrintSandboxTeardownMessage(SandBoxConsolePort, docker.SandboxKubeconfig)
})
}

Expand Down