-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version 1.10.0
- Loading branch information
Showing
5 changed files
with
71 additions
and
18 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
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,51 @@ | ||
from __future__ import annotations | ||
import logging | ||
from typing import Any, Dict, Optional, List, TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from pyobs.robotic import TaskRunner, TaskSchedule, TaskArchive | ||
from pyobs.robotic.scripts import Script | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class CallModule(Script): | ||
"""Script for calling method on a module.""" | ||
|
||
__module__ = "pyobs.modules.robotic" | ||
|
||
def __init__( | ||
self, | ||
module: str, | ||
method: str, | ||
params: Optional[List[Any]], | ||
**kwargs: Any, | ||
): | ||
"""Initialize a new SequentialRunner. | ||
Args: | ||
script: list or dict of scripts to run in a sequence. | ||
""" | ||
Script.__init__(self, **kwargs) | ||
self.module = module | ||
self.method = method | ||
self.params = params or [] | ||
|
||
async def can_run(self) -> bool: | ||
try: | ||
self.comm.proxy(self.module) | ||
return True | ||
except ValueError: | ||
return False | ||
|
||
async def run( | ||
self, | ||
task_runner: TaskRunner, | ||
task_schedule: Optional[TaskSchedule] = None, | ||
task_archive: Optional[TaskArchive] = None, | ||
) -> None: | ||
proxy = self.comm.proxy(self.module) | ||
await proxy.execute(self.method, *self.params) | ||
|
||
|
||
__all__ = ["CallModule"] |
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,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "pyobs-core" | ||
packages = [{ include = "pyobs" }] | ||
version = "1.9.0" | ||
version = "1.10.0" | ||
description = "robotic telescope software" | ||
authors = ["Tim-Oliver Husser <[email protected]>"] | ||
license = "MIT" | ||
|