Skip to content

Commit

Permalink
save state
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Kamat <[email protected]>
  • Loading branch information
ayushkamat committed Nov 13, 2024
1 parent cdb680b commit 326f7bd
Show file tree
Hide file tree
Showing 20 changed files with 1,795 additions and 1,168 deletions.
6 changes: 3 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Setup

install:
uv sync
uv sync --group dev --group docs

# Packaging

Expand All @@ -16,8 +16,8 @@ publish:
# Testing

test:
export TEST_TOKEN=$(cat ~/.latch/token) &&\
pytest -s tests
export TEST_TOKEN=$(cat ~/.latch/token)
pytest -s

# Docs

Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = ["src/**/*.py", "src/latch_cli/services/init/*"]

[project]
name = "latch"
version = "2.54.0.a3"
version = "2.54.0.a8"
description = "The Latch SDK"
authors = [{ name = "Kenny Workman", email = "[email protected]" }]
maintainers = [
Expand All @@ -34,13 +34,13 @@ dependencies = [
"scp>=0.14.0",
"boto3>=1.26.0",
"tqdm>=4.63.0",
"lytekit==0.15.13",
"lytekit==0.15.14",
"lytekitplugins-pods==0.6.2",
"typing-extensions>=4.12.0",
"apscheduler>=3.10.0",
"gql==3.4.0",
"gql>=3.5.0,<4.0.0",
"graphql-core==3.2.3",
"requests-toolbelt==0.10.1",
"requests-toolbelt>=1.0.0,<2.0.0",
"python-dateutil>=2.8",
"GitPython==3.1.40",

Expand Down Expand Up @@ -98,11 +98,10 @@ docs = [
]

[tool.ruff]
line-length = 100
target-version = "py39"

[tool.ruff.lint]
preview = true

pydocstyle = { convention = "google" }
extend-select = [
"F",
Expand Down Expand Up @@ -171,6 +170,9 @@ ignore = [

"ANN101",
"ANN102",
"ANN201",

"D202",

"E402",
"E501",
Expand Down
38 changes: 27 additions & 11 deletions src/latch/resources/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ def _get_small_pod() -> Pod:
)
},
pod_spec=V1PodSpec(
runtime_class_name="sysbox-runc",
containers=[primary_container],
runtime_class_name="sysbox-runc", containers=[primary_container]
),
primary_container_name="primary",
)
Expand Down Expand Up @@ -517,11 +516,7 @@ class _NGConfig:
max_storage_gb_ish = int(max_storage_gib * Units.GiB / Units.GB)


def _custom_task_config(
cpu: int,
memory: int,
storage_gib: int,
) -> Pod:
def _custom_task_config(cpu: int, memory: int, storage_gib: int) -> Pod:
target_ng = None
for ng in taint_data:
if (
Expand Down Expand Up @@ -591,10 +586,7 @@ def custom_task(
"""
if callable(cpu) or callable(memory) or callable(storage_gib):
task_config = DynamicTaskConfig(
cpu=cpu,
memory=memory,
storage=storage_gib,
pod_config=_get_small_pod(),
cpu=cpu, memory=memory, storage=storage_gib, pod_config=_get_small_pod()
)
return functools.partial(task, task_config=task_config, timeout=timeout)

Expand Down Expand Up @@ -627,3 +619,27 @@ def nextflow_runtime_task(cpu: int, memory: int, storage_gib: int = 50):
]

return functools.partial(task, task_config=task_config)


def snakemake_runtime_task(*, cpu: int, memory: int, storage_gib: int = 50):
task_config = _custom_task_config(cpu, memory, storage_gib)

task_config.pod_spec.automount_service_account_token = True

assert len(task_config.pod_spec.containers) == 1
task_config.pod_spec.containers[0].volume_mounts = [
V1VolumeMount(mount_path="/snakemake-workdir", name="snakemake-workdir")
]

task_config.pod_spec.volumes = [
V1Volume(
name="snakemake-workdir",
persistent_volume_claim=V1PersistentVolumeClaimVolumeSource(
# this value will be injected by flytepropeller
# ayush: this is also used by snakemake bc why not
claim_name="nextflow-pvc-placeholder"
),
)
]

return functools.partial(task, task_config=task_config)
2 changes: 1 addition & 1 deletion src/latch/types/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def file_glob(
represented by the `remote_directory`.
Args:
pattern: A glob pattern to match a set of files, eg. '\*.py'. Will
pattern: A glob pattern to match a set of files, eg. '*.py'. Will
resolve paths with respect to the working directory of the caller.
remote_directory: A valid latch URL pointing to a directory, eg.
latch:///foo. This _must_ be a directory and not a file.
Expand Down
Loading

0 comments on commit 326f7bd

Please sign in to comment.