generated from ssec-jhu/base-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into iainland/calibration-file-and-resume
- Loading branch information
Showing
12 changed files
with
224 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from fastapi import APIRouter, Request | ||
|
||
from evolver.device import Experiment | ||
|
||
router = APIRouter(prefix="/experiment", tags=["experiment"]) | ||
|
||
|
||
@router.get("/") | ||
def get_experiments(request: Request) -> dict[str, Experiment]: | ||
return request.app.state.evolver.experiments | ||
|
||
|
||
@router.get("/{experiment_name}/logs") | ||
def get_experiment_logs(request: Request, experiment_name: str): | ||
evolver = request.app.state.evolver | ||
controllers = evolver.experiments[experiment_name].controllers | ||
names = [c.name for c in controllers if c.name] | ||
return evolver.history.get(names=names, kinds=["log", "event"]) | ||
|
||
|
||
@router.get("/{experiment_name}") | ||
def get_experiment_overview(request: Request, experiment_name: str): | ||
return { | ||
"config": request.app.state.evolver.experiments[experiment_name], | ||
"logs": get_experiment_logs(request, experiment_name), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from evolver.controller.interface import Controller | ||
from evolver.logutils import EVENT | ||
|
||
|
||
class NoOpController(Controller): | ||
ncalls = 0 | ||
|
||
def control(self, *args, **kwargs): | ||
self.logger.log(EVENT, "NoOpController control called") | ||
self.ncalls += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.