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
Merge requests
!322
Prepare for new Gaudi::Algorithm
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Prepare for new Gaudi::Algorithm
cherry-pick-5284ec31
into
run2-patches
Overview
1
Commits
1
Pipelines
0
Changes
1
Merged
Marco Clemencic
requested to merge
cherry-pick-5284ec31
into
run2-patches
5 years ago
Overview
1
Commits
1
Pipelines
0
Changes
1
Expand
See merge request
!281 (merged)
(cherry picked from commit
5284ec31
)
0
0
Merge request reports
Compare
run2-patches
run2-patches (base)
and
latest version
latest version
01745a37
1 commit,
5 years ago
1 file
+
98
−
79
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
DaVinciTests/tests/options/gpython_algs.py
+
98
−
79
Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file gpython_algs
# simmple test for two problems
# - contrintuitive IAlgorithm::isInitialize [But ok...]
# - ALG-fuctors, created from python prompt/loop
# [it is ok when they are created via Hybrid framework]
# @author Vanya BELYAEV
# @date 2016-01-29
# =============================================================================
##
## Configurables:
##
from
Configurables
import
DaVinci
,
MessageSvc
dv
=
DaVinci
(
DataType
=
'
2015
'
,
InputType
=
'
DST
'
,
Lumi
=
True
)
##
## put some algorithms into "user" list
##
from
StandardParticles
import
StdLooseKaons
from
PhysSelPython.Wrappers
import
SelectionSequence
seq
=
SelectionSequence
(
'
KAONS
'
,
StdLooseKaons
)
dv
.
UserAlgorithms
+=
[
seq
.
sequence
()
]
## produde a lot of prints
## msg = MessageSvc ( OutputLevel = 2 )
## get some input data
from
PRConfig
import
TestFileDB
TestFileDB
.
test_file_db
[
"
2015_DaVinciTests.davinci.gaudipython_algs
"
].
run
(
configurable
=
DaVinci
())
##
## GaudiPython
##
from
GaudiPython.Bindings
import
AppMgr
gaudi
=
AppMgr
()
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
mainseq
=
'
DaVinciEventSeq
'
from
LoKiHlt.algorithms
import
ALG_EXECUTED
,
ALG_PASSED
,
ALG_ENABLED
## start event loop
for
i
in
range
(
10
)
:
gaudi
.
run
(
1
)
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
print
'
[%d] KAONS initialized? %s [counterintuitive]
'
%
(
i
,
alg
.
_ialg
.
isInitialized
()
)
print
'
[%d] KAONS executed? %s
'
%
(
i
,
alg
.
_ialg
.
isExecuted
()
)
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
# =============================================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
# =============================================================================
## @file gpython_algs
# simmple test for two problems
# - contrintuitive IAlgorithm::isInitialize [But ok...]
# - ALG-fuctors, created from python prompt/loop
# [it is ok when they are created via Hybrid framework]
# @author Vanya BELYAEV
# @date 2016-01-29
# =============================================================================
##
## Configurables:
##
from
Configurables
import
DaVinci
,
MessageSvc
dv
=
DaVinci
(
DataType
=
'
2015
'
,
InputType
=
'
DST
'
,
Lumi
=
True
)
##
## put some algorithms into "user" list
##
from
StandardParticles
import
StdLooseKaons
from
PhysSelPython.Wrappers
import
SelectionSequence
seq
=
SelectionSequence
(
'
KAONS
'
,
StdLooseKaons
)
dv
.
UserAlgorithms
+=
[
seq
.
sequence
()
]
## produde a lot of prints
## msg = MessageSvc ( OutputLevel = 2 )
## get some input data
from
PRConfig
import
TestFileDB
TestFileDB
.
test_file_db
[
"
2015_DaVinciTests.davinci.gaudipython_algs
"
].
run
(
configurable
=
DaVinci
())
##
## GaudiPython
##
def
isExecuted
(
alg
):
if
hasattr
(
alg
.
_ialg
,
'
isExecuted
'
):
return
alg
.
_ialg
.
isExecuted
()
else
:
import
GaudiPython
# make sure we pulled needed classes in cppyy
from
cppyy.gbl
import
Gaudi
,
AlgExecState
return
(
alg
.
_ialg
.
execState
(
Gaudi
.
Hive
.
currentContext
()).
state
()
==
AlgExecState
.
Done
)
from
GaudiPython.Bindings
import
AppMgr
gaudi
=
AppMgr
()
alg
=
gaudi
.
algorithm
(
'
KAONS
'
)
mainseq
=
'
DaVinciEventSeq
'
from
LoKiHlt.algorithms
import
ALG_EXECUTED
,
ALG_PASSED
,
ALG_ENABLED
## start event loop
for
i
in
range
(
10
)
:
gaudi
.
run
(
1
)
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
# =============================================================================
Loading