From 8bdbdeea5cde1cb85ba19f77ac74169b716ca0fd Mon Sep 17 00:00:00 2001 From: epwalsh Date: Fri, 14 Jun 2024 09:31:17 -0700 Subject: [PATCH 1/3] Add `weka` option to `DataSource` --- CHANGELOG.md | 4 ++++ beaker/data_model/experiment_spec.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52d6ef4..61a7828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ use patch releases for compatibility fixes instead. ## Unreleased +### Added + +- Added `weka` option to `DataSource` model. + ### Fixed - Only check for upgrades once every 12 hours by default. diff --git a/beaker/data_model/experiment_spec.py b/beaker/data_model/experiment_spec.py index ef132f3..0dabce3 100644 --- a/beaker/data_model/experiment_spec.py +++ b/beaker/data_model/experiment_spec.py @@ -101,6 +101,11 @@ class DataSource(BaseModel, frozen=False): - ``/var/beaker/share`` as a shared local scratch space. """ + weka: Optional[str] = None + """ + The name of a weka bucket. + """ + result: Optional[str] = None """ Name of a previous task whose result will be mounted. From 1a7c61f5e4bee9daf7074ac3947b5da5f2ead33e Mon Sep 17 00:00:00 2001 From: epwalsh Date: Fri, 14 Jun 2024 09:38:40 -0700 Subject: [PATCH 2/3] fix --- beaker/data_model/experiment_spec.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beaker/data_model/experiment_spec.py b/beaker/data_model/experiment_spec.py index 0dabce3..243b54d 100644 --- a/beaker/data_model/experiment_spec.py +++ b/beaker/data_model/experiment_spec.py @@ -167,6 +167,7 @@ def new( sub_path: Optional[str] = None, beaker: Optional[str] = None, host_path: Optional[str] = None, + weka: Optional[str] = None, result: Optional[str] = None, secret: Optional[str] = None, ) -> "DataMount": @@ -177,6 +178,7 @@ def new( :param sub_path: The :data:`sub_path`. :param beaker: The :data:`beaker ` argument to :class:`DataSource`. :param host_path: The :data:`host_path ` argument to :class:`DataSource`. + :param weka: The :data:`weka ` argument to :class:`DataSource`. :param result: The :data:`result ` argument to :class:`DataSource`. :param url: The :data:`url ` argument to :class:`DataSource`. :param secret: The :data:`secret ` argument to :class:`DataSource`. @@ -187,6 +189,7 @@ def new( source=DataSource( beaker=beaker, host_path=host_path, + weka=weka, result=result, secret=secret, ), From 0d62c44b11ece2ec2a6f8e96d39a5479ffd15373 Mon Sep 17 00:00:00 2001 From: epwalsh Date: Fri, 14 Jun 2024 09:43:32 -0700 Subject: [PATCH 3/3] fix tests --- tests/client_test.py | 3 +++ tests/data_model_test.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/client_test.py b/tests/client_test.py index 531158c..329d07e 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -2,6 +2,7 @@ from flaky import flaky from beaker import Beaker +from beaker.config import InternalConfig @flaky # this can fail if the request to GitHub fails @@ -9,6 +10,8 @@ def test_warn_for_newer_version(monkeypatch): import beaker.client import beaker.version + InternalConfig().save() + monkeypatch.setattr(Beaker, "CLIENT_VERSION", "0.1.0") monkeypatch.setattr(beaker.client, "_LATEST_VERSION_CHECKED", False) diff --git a/tests/data_model_test.py b/tests/data_model_test.py index facf20a..3117eca 100644 --- a/tests/data_model_test.py +++ b/tests/data_model_test.py @@ -93,10 +93,16 @@ def test_experiment_spec_validation(): def test_snake_case_vs_lower_camel_case(): for x in (DataSource(host_path="/tmp/foo"), DataSource(hostPath="/tmp/foo")): # type: ignore - assert str(x) == "DataSource(beaker=None, host_path='/tmp/foo', result=None, secret=None)" + assert ( + str(x) + == "DataSource(beaker=None, host_path='/tmp/foo', weka=None, result=None, secret=None)" + ) assert x.host_path == "/tmp/foo" x.host_path = "/tmp/bar" - assert str(x) == "DataSource(beaker=None, host_path='/tmp/bar', result=None, secret=None)" + assert ( + str(x) + == "DataSource(beaker=None, host_path='/tmp/bar', weka=None, result=None, secret=None)" + ) assert x.to_json() == {"hostPath": "/tmp/bar"}