Skip to content

Commit a811bff

Browse files
committed
Make openeo.extra.job_management a package (instead of module)
to prepare for future extensions, e.g. #619
1 parent 29d9b16 commit a811bff

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
_log = logging.getLogger(__name__)
4343

44+
4445
class _Backend(NamedTuple):
4546
"""Container for backend info/settings"""
4647

@@ -357,6 +358,7 @@ def start_job_thread(self, start_job: Callable[[], BatchJob], job_db: JobDatabas
357358
_log.info(f"Resuming `run_jobs` from existing {job_db}")
358359

359360
self._stop_thread = False
361+
360362
def run_loop():
361363

362364
# TODO: support user-provided `stats`
@@ -855,6 +857,7 @@ class CsvJobDatabase(FullDataFrameJobDatabase):
855857
856858
.. versionadded:: 0.31.0
857859
"""
860+
858861
def __init__(self, path: Union[str, Path]):
859862
super().__init__()
860863
self.path = Path(path)
@@ -911,6 +914,7 @@ class ParquetJobDatabase(FullDataFrameJobDatabase):
911914
912915
.. versionadded:: 0.31.0
913916
"""
917+
914918
def __init__(self, path: Union[str, Path]):
915919
super().__init__()
916920
self.path = Path(path)
@@ -933,6 +937,7 @@ def read(self) -> pd.DataFrame:
933937
metadata = pyarrow.parquet.read_metadata(self.path)
934938
if b"geo" in metadata.metadata:
935939
import geopandas
940+
936941
return geopandas.read_parquet(self.path)
937942
else:
938943
return pd.read_parquet(self.path)
@@ -1044,6 +1049,7 @@ class ProcessBasedJobCreator:
10441049
`feedback and suggestions for improvement <https://github.com/Open-EO/openeo-python-client/issues>`_.
10451050
10461051
"""
1052+
10471053
def __init__(
10481054
self,
10491055
*,
@@ -1076,7 +1082,6 @@ def _get_process_definition(self, connection: Connection) -> Process:
10761082
f"Unsupported process definition source udp_id={self._process_id!r} namespace={self._namespace!r}"
10771083
)
10781084

1079-
10801085
def start_job(self, row: pd.Series, connection: Connection, **_) -> BatchJob:
10811086
"""
10821087
Implementation of the ``start_job`` callable interface

tests/extra/test_job_management.py renamed to tests/extra/job_management/test_job_management.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -833,20 +833,20 @@ def test_partial_read_write(self, tmp_path, orig: pandas.DataFrame):
833833
assert path.exists()
834834

835835
loaded = db.get_by_status(statuses=["not_started"], max=2)
836-
assert db.count_by_status(statuses=["not_started"])["not_started"] >1
836+
assert db.count_by_status(statuses=["not_started"])["not_started"] > 1
837837

838838
assert len(loaded) == 2
839-
loaded.loc[0,"status"] = "running"
839+
loaded.loc[0, "status"] = "running"
840840
loaded.loc[1, "status"] = "error"
841841
db.persist(loaded)
842842
assert db.count_by_status(statuses=["error"])["error"] == 1
843843

844844
all = db.read()
845845
assert len(all) == len(orig)
846-
assert all.loc[0,"status"] == "running"
847-
assert all.loc[1,"status"] == "error"
848-
if(len(all) >2):
849-
assert all.loc[2,"status"] == "not_started"
846+
assert all.loc[0, "status"] == "running"
847+
assert all.loc[1, "status"] == "error"
848+
if len(all) > 2:
849+
assert all.loc[2, "status"] == "not_started"
850850
print(loaded.index)
851851

852852
def test_initialize_from_df(self, tmp_path):

0 commit comments

Comments
 (0)