Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DaVinci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb
DaVinci
Commits
01745a37
Commit
01745a37
authored
5 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Patches
Plain Diff
Prepare for new Gaudi::Algorithm
See merge request
!281
(cherry picked from commit
5284ec31
)
parent
4c97eccd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!322
Prepare for new Gaudi::Algorithm
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DaVinciTests/tests/options/gpython_algs.py
+98
-79
98 additions, 79 deletions
DaVinciTests/tests/options/gpython_algs.py
with
98 additions
and
79 deletions
DaVinciTests/tests/options/gpython_algs.py
+
98
−
79
View file @
01745a37
#!/usr/bin/env python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# =============================================================================
###############################################################################
## @file gpython_algs
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration #
# simmple test for two problems
# #
# - contrintuitive IAlgorithm::isInitialize [But ok...]
# This software is distributed under the terms of the GNU General Public #
# - ALG-fuctors, created from python prompt/loop
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# [it is ok when they are created via Hybrid framework]
# #
# @author Vanya BELYAEV
# In applying this licence, CERN does not waive the privileges and immunities #
# @date 2016-01-29
# granted to it by virtue of its status as an Intergovernmental Organization #
# =============================================================================
# or submit itself to any jurisdiction. #
###############################################################################
##
# =============================================================================
## Configurables:
## @file gpython_algs
##
# simmple test for two problems
from
Configurables
import
DaVinci
,
MessageSvc
# - contrintuitive IAlgorithm::isInitialize [But ok...]
dv
=
DaVinci
(
# - ALG-fuctors, created from python prompt/loop
DataType
=
'
2015
'
,
# [it is ok when they are created via Hybrid framework]
InputType
=
'
DST
'
,
# @author Vanya BELYAEV
Lumi
=
True
# @date 2016-01-29
)
# =============================================================================
##
##
## put some algorithms into "user" list
## Configurables:
##
##
from
StandardParticles
import
StdLooseKaons
from
Configurables
import
DaVinci
,
MessageSvc
from
PhysSelPython.Wrappers
import
SelectionSequence
dv
=
DaVinci
(
seq
=
SelectionSequence
(
'
KAONS
'
,
StdLooseKaons
)
DataType
=
'
2015
'
,
dv
.
UserAlgorithms
+=
[
seq
.
sequence
()
]
InputType
=
'
DST
'
,
Lumi
=
True
## produde a lot of prints
)
## msg = MessageSvc ( OutputLevel = 2 )
##
## put some algorithms into "user" list
## get some input data
##
from
PRConfig
import
TestFileDB
from
StandardParticles
import
StdLooseKaons
TestFileDB
.
test_file_db
[
"
2015_DaVinciTests.davinci.gaudipython_algs
"
].
run
(
configurable
=
DaVinci
())
from
PhysSelPython.Wrappers
import
SelectionSequence
seq
=
SelectionSequence
(
'
KAONS
'
,
StdLooseKaons
)
dv
.
UserAlgorithms
+=
[
seq
.
sequence
()
]
##
## GaudiPython
## produde a lot of prints
##
## msg = MessageSvc ( OutputLevel = 2 )
from
GaudiPython.Bindings
import
AppMgr
## get some input data
gaudi
=
AppMgr
()
from
PRConfig
import
TestFileDB
TestFileDB
.
test_file_db
[
"
2015_DaVinciTests.davinci.gaudipython_algs
"
].
run
(
configurable
=
DaVinci
())
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
##
mainseq
=
'
DaVinciEventSeq
'
## GaudiPython
##
from
LoKiHlt.algorithms
import
ALG_EXECUTED
,
ALG_PASSED
,
ALG_ENABLED
## start event loop
def
isExecuted
(
alg
):
for
i
in
range
(
10
)
:
if
hasattr
(
alg
.
_ialg
,
'
isExecuted
'
):
return
alg
.
_ialg
.
isExecuted
()
gaudi
.
run
(
1
)
else
:
import
GaudiPython
# make sure we pulled needed classes in cppyy
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
from
cppyy.gbl
import
Gaudi
,
AlgExecState
print
'
[%d] KAONS initialized? %s [counterintuitive]
'
%
(
i
,
alg
.
_ialg
.
isInitialized
()
)
return
(
alg
.
_ialg
.
execState
(
Gaudi
.
Hive
.
currentContext
()).
state
()
print
'
[%d] KAONS executed? %s
'
%
(
i
,
alg
.
_ialg
.
isExecuted
()
)
==
AlgExecState
.
Done
)
from
GaudiPython.Bindings
import
AppMgr
print
'
without fix in $LOKICORE/src/AlgFunctors.cpp following lines produce segmentation violation
'
fun1
=
ALG_EXECUTED
(
mainseq
)
gaudi
=
AppMgr
()
fun2
=
ALG_PASSED
(
mainseq
)
fun3
=
ALG_ENABLED
(
mainseq
)
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
print
'
[%d] main sequence executed? %s
'
%
(
i
,
fun1
()
)
print
'
[%d] main sequence passed? %s
'
%
(
i
,
fun2
()
)
mainseq
=
'
DaVinciEventSeq
'
print
'
[%d] main sequence enabled? %s
'
%
(
i
,
fun3
()
)
from
LoKiHlt.algorithms
import
ALG_EXECUTED
,
ALG_PASSED
,
ALG_ENABLED
## start event loop
exit
()
for
i
in
range
(
10
)
:
gaudi
.
run
(
1
)
# =============================================================================
# The END
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
# =============================================================================
print
'
[%d] KAONS initialized? %s [counterintuitive]
'
%
(
i
,
alg
.
_ialg
.
isInitialized
()
)
print
'
[%d] KAONS executed? %s
'
%
(
i
,
isExecuted
(
alg
)
)
print
'
without fix in $LOKICORE/src/AlgFunctors.cpp following lines produce segmentation violation
'
fun1
=
ALG_EXECUTED
(
mainseq
)
fun2
=
ALG_PASSED
(
mainseq
)
fun3
=
ALG_ENABLED
(
mainseq
)
print
'
[%d] main sequence executed? %s
'
%
(
i
,
fun1
()
)
print
'
[%d] main sequence passed? %s
'
%
(
i
,
fun2
()
)
print
'
[%d] main sequence enabled? %s
'
%
(
i
,
fun3
()
)
exit
()
# =============================================================================
# The END
# =============================================================================
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment