Skip to content

Commit

Permalink
Fix: Program vcpus and timeout could not be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
hoh committed Apr 29, 2022
1 parent a26d011 commit 1cf989a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/aleph_client/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ def program(
entrypoint: str,
channel: str = settings.DEFAULT_CHANNEL,
memory: int = settings.DEFAULT_VM_MEMORY,
vcpus: int = settings.DEFAULT_VM_VCPUS,
timeout_seconds: float = settings.DEFAULT_VM_TIMEOUT,
private_key: Optional[str] = settings.PRIVATE_KEY_STRING,
private_key_file: Optional[str] = settings.PRIVATE_KEY_FILE,
print_messages: bool = False,
Expand Down Expand Up @@ -364,6 +366,8 @@ def program(
storage_engine=StorageEnum.storage,
channel=channel,
memory=memory,
vcpus=vcpus,
timeout_seconds=timeout_seconds,
encoding=encoding,
volumes=volumes,
subscriptions=subscriptions,
Expand Down
6 changes: 4 additions & 2 deletions src/aleph_client/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ async def create_program(
session: Optional[ClientSession] = None,
api_server: str = settings.API_HOST,
memory: int = settings.DEFAULT_VM_MEMORY,
vcpus: int = settings.DEFAULT_VM_VCPUS,
timeout_seconds: float = settings.DEFAULT_VM_TIMEOUT,
encoding: Encoding = Encoding.zip,
volumes: List[Dict] = None,
subscriptions: Optional[List[Dict]] = None,
Expand Down Expand Up @@ -306,9 +308,9 @@ async def create_program(
"aleph_api": True,
},
"resources": {
"vcpus": 1,
"vcpus": vcpus,
"memory": memory,
"seconds": 30,
"seconds": timeout_seconds,
},
"runtime": {
"ref": runtime,
Expand Down
2 changes: 2 additions & 0 deletions src/aleph_client/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Settings(BaseSettings):
"bd79839bf96e595a06da5ac0b6ba51dea6f7e2591bb913deccded04d831d29f4"
)
DEFAULT_VM_MEMORY: int = 128
DEFAULT_VM_VCPUS: int = 1
DEFAULT_VM_TIMEOUT: float = 30.

CODE_USES_SQUASHFS: bool = which("mksquashfs") is not None # True if command exists

Expand Down
4 changes: 4 additions & 0 deletions src/aleph_client/synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def create_program(
session: Optional[ClientSession] = None,
api_server: str = settings.API_HOST,
memory: int = settings.DEFAULT_VM_MEMORY,
vcpus: int = settings.DEFAULT_VM_VCPUS,
timeout_seconds: float = settings.DEFAULT_VM_TIMEOUT,
encoding: Encoding = Encoding.zip,
volumes: List[Dict] = None,
subscriptions: Optional[List[Dict]] = None,
Expand All @@ -70,6 +72,8 @@ def create_program(
session=session,
api_server=api_server,
memory=memory,
vcpus=vcpus,
timeout_seconds=timeout_seconds,
encoding=encoding,
volumes=volumes,
subscriptions=subscriptions,
Expand Down

0 comments on commit 1cf989a

Please sign in to comment.