Skip to content

Commit

Permalink
- Support JetBrains Fleet as an alternative IDE for dev environments #…
Browse files Browse the repository at this point in the history
…821 (POC)
  • Loading branch information
peterschmidt85 committed Dec 29, 2023
1 parent b3269fb commit 1f5dc6a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dstack/_internal/core/models/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def convert_ports(cls, v) -> PortMapping:

class DevEnvironmentConfiguration(BaseConfigurationWithPorts):
type: Literal["dev-environment"] = "dev-environment"
ide: Annotated[Literal["vscode"], Field(description="The IDE to run")]
ide: Annotated[Literal["vscode", "fleet"], Field(description="The IDE to run")]
version: Annotated[Optional[str], Field(description="The version of the IDE")]
init: Annotated[CommandsList, Field(description="The bash commands to run")] = []

Expand Down
13 changes: 9 additions & 4 deletions src/dstack/_internal/server/services/jobs/configurators/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dstack._internal.core.models.profiles import ProfileRetryPolicy, SpotPolicy
from dstack._internal.core.models.runs import RetryPolicy, RunSpec
from dstack._internal.server.services.jobs.configurators.base import JobConfigurator
from dstack._internal.server.services.jobs.configurators.extensions.fleet import JetBrainsFleet
from dstack._internal.server.services.jobs.configurators.extensions.vscode import VSCodeDesktop

DEFAULT_MAX_DURATION_SECONDS = 6 * 3600
Expand All @@ -18,10 +19,14 @@ class DevEnvironmentJobConfigurator(JobConfigurator):
TYPE: ConfigurationType = ConfigurationType.DEV_ENVIRONMENT

def __init__(self, run_spec: RunSpec):
self.ide = VSCodeDesktop(
run_name=run_spec.run_name,
version=run_spec.configuration.version,
extensions=["ms-python.python", "ms-toolsai.jupyter"],
self.ide = (
VSCodeDesktop(
run_name=run_spec.run_name,
version=run_spec.configuration.version,
extensions=["ms-python.python", "ms-toolsai.jupyter"],
)
if run_spec.configuration.ide == "vscode"
else JetBrainsFleet(run_name=run_spec.run_name)
)
super().__init__(run_spec)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import List


class JetBrainsFleet:
def __init__(self, run_name: str):
self.run_name = run_name

def get_install_commands(self) -> List[str]:
commands = [
f'if [ $(uname -m) = "aarch64" ]; then arch="aarch64"; else arch="x64"; fi',
'wget -q --show-progress -O fleet "https://download.jetbrains.com/product?code=FLL&release.type=preview&release.type=eap&platform=linux_$arch" && chmod +x fleet',
f"./fleet launch workspace -- --auth=accept-everyone --publish --workspaceName {self.run_name} --projectDir /workflow",
]
return commands

def get_print_readme_commands(self) -> List[str]:
return []

0 comments on commit 1f5dc6a

Please sign in to comment.