Skip to content

Commit

Permalink
statuses are now all uppercase again
Browse files Browse the repository at this point in the history
  • Loading branch information
TShapinsky committed Dec 6, 2023
1 parent e13f8b5 commit ac52e87
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion alfalfa_client/alfalfa_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def wait(self, run_id: Union[RunID, List[RunID]], desired_status: str, timeout:
if current_status != previous_status:
print("Desired status: {}\t\tCurrent status: {}".format(desired_status, current_status))
previous_status = current_status
if current_status == desired_status:
if current_status == desired_status.upper():
return
sleep(2)
raise AlfalfaClientException(f"'wait' timed out waiting for status: '{desired_status}', current status: '{current_status}'")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run_id(client: AlfalfaClient, model_path: Path):
yield run_id

status = client.status(run_id)
if status == "running":
if status == "RUNNING":
client.stop(run_id)


Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_single_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_advance(client: AlfalfaClient, external_clock_run_id: str):

@pytest.mark.integration
def test_status(client: AlfalfaClient, internal_clock_run_id: str):
assert client.status(internal_clock_run_id) == "running"
assert client.status(internal_clock_run_id) == "RUNNING"


@pytest.mark.integration
Expand All @@ -39,7 +39,7 @@ def test_output(client: AlfalfaClient, internal_clock_run_id: str):
@pytest.mark.integration
def test_stop(client: AlfalfaClient, internal_clock_run_id: str):
client.stop(internal_clock_run_id)
assert client.status(internal_clock_run_id) == "complete"
assert client.status(internal_clock_run_id) == "COMPLETE"


@pytest.mark.integration
Expand Down
28 changes: 14 additions & 14 deletions tests/integration/test_small_office.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@
@pytest.mark.integration
def test_basic_io():
alfalfa = AlfalfaClient(host='http://localhost')
model_id = alfalfa.submit('tests/integration/models/small_office')
run_id = alfalfa.submit('tests/integration/models/small_office')

alfalfa.wait(model_id, "ready")
alfalfa.wait(run_id, "ready")
alfalfa.start(
model_id,
run_id,
external_clock=True,
start_datetime=datetime(2019, 1, 2, 0, 2, 0),
end_datetime=datetime(2019, 1, 3, 0, 0, 0)
)

alfalfa.wait(model_id, "running")
alfalfa.wait(run_id, "running")

inputs = alfalfa.get_inputs(model_id)
inputs = alfalfa.get_inputs(run_id)
assert "Test_Point_1" in inputs, "Test_Point_1 is in input points"
inputs = {}
inputs["Test_Point_1"] = 12

alfalfa.set_inputs(model_id, inputs)
alfalfa.set_inputs(run_id, inputs)

outputs = alfalfa.get_outputs(model_id)
outputs = alfalfa.get_outputs(run_id)
assert "Test_Point_1" in outputs.keys(), "Echo point for Test_Point_1 is not in outputs"

# -- Advance a single time step
alfalfa.advance(model_id)
alfalfa.advance(run_id)

outputs = alfalfa.get_outputs(model_id)
outputs = alfalfa.get_outputs(run_id)

assert pytest.approx(12) == outputs["Test_Point_1"], "Test_Point_1 value has not been processed by the model"

# Shut down
alfalfa.stop(model_id)
alfalfa.wait(model_id, "complete")
alfalfa.stop(run_id)
alfalfa.wait(run_id, "complete")


@pytest.mark.integration
Expand All @@ -52,7 +52,7 @@ def test_many_model_operations():
run_ids = alfalfa.submit(model_path=model_paths)

for run_id in run_ids:
assert alfalfa.status(run_id) == "ready", "Run has incorrect status"
assert alfalfa.status(run_id) == "READY", "Run has incorrect status"

# Start Runs
start_datetime = datetime(2022, 1, 1, 0, 0)
Expand All @@ -62,7 +62,7 @@ def test_many_model_operations():
external_clock=True)

for run_id in run_ids:
assert alfalfa.status(run_id) == "running", "Run has incorrect status"
assert alfalfa.status(run_id) == "RUNNING", "Run has incorrect status"

# Advance Runs
sim_datetime = start_datetime
Expand All @@ -77,4 +77,4 @@ def test_many_model_operations():
alfalfa.stop(run_ids)

for run_id in run_ids:
assert alfalfa.status(run_id) == "complete", "Run has incorrect status"
assert alfalfa.status(run_id) == "COMPLETE", "Run has incorrect status"

0 comments on commit ac52e87

Please sign in to comment.