-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find runs on GRID directly with the Dirac python API (#90)
* Add method to fetch data from GRID with DIRAC API (to avoid reading the NectarCAM ELog). The method using the Elog is kept as fallback. * fix a strange bug where DIRAC modify environment of logging which becomes in conflict with ctapipe --------- Co-authored-by: guillaume.grolleron <[email protected]>
- Loading branch information
1 parent
270c103
commit 6f11e5f
Showing
4 changed files
with
122 additions
and
12 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
from .error import * | ||
from .io import * | ||
from .logger import * | ||
from .utils import * |
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,22 @@ | ||
import logging | ||
import sys | ||
|
||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s %(message)s") | ||
log = logging.getLogger(__name__) | ||
log.handlers = logging.getLogger("__main__").handlers | ||
|
||
|
||
class StdoutRecord: | ||
def __init__(self, keyword): | ||
self.console = sys.stdout | ||
self.keyword = keyword | ||
self.output = [] | ||
|
||
def write(self, message): | ||
if self.keyword in message: | ||
self.console.write(message) | ||
self.console.write("\n") | ||
self.output.append(message) | ||
|
||
def flush(self): | ||
self.console.flush() |
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,27 @@ | ||
import logging | ||
|
||
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s %(message)s") | ||
log = logging.getLogger(__name__) | ||
log.handlers = logging.getLogger("__main__").handlers | ||
|
||
import copy | ||
|
||
|
||
class KeepLoggingUnchanged: | ||
def __init__(self): | ||
self._nameToLevel = None | ||
self._levelToName = None | ||
self._srcfile = None | ||
# self._lock = None | ||
|
||
def __enter__(self): | ||
self._nameToLevel = copy.copy(logging._nameToLevel) | ||
self._levelToName = copy.copy(logging._levelToName) | ||
self._srcfile = copy.copy(logging._srcfile) | ||
# self._lock = copy.copy(logging._lock) | ||
|
||
def __exit__(self, type, value, traceback): | ||
logging._levelToName = self._levelToName | ||
logging._nameToLevel = self._nameToLevel | ||
logging._srcfile = self._srcfile | ||
# logging._lock = self._lock |