Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CTADIRAC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Michele Sanguillon
CTADIRAC
Commits
83e447d8
Commit
83e447d8
authored
11 years ago
by
Luisa Arrabito
Browse files
Options
Downloads
Patches
Plain Diff
Script to run read_hess
parent
96e4ea3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/scripts/cta-read_hess.py
+101
-0
101 additions, 0 deletions
Core/scripts/cta-read_hess.py
with
101 additions
and
0 deletions
Core/scripts/cta-read_hess.py
0 → 100644
+
101
−
0
View file @
83e447d8
#!/usr/bin/env python
import
DIRAC
import
os
def
main
():
from
DIRAC
import
gLogger
from
DIRAC.Core.Base
import
Script
Script
.
parseCommandLine
(
ignoreErrors
=
True
)
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
checkSoftwarePackage
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
installSoftwarePackage
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
installSoftwareEnviron
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
localArea
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
sharedArea
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
getSoftwareEnviron
from
CTADIRAC.Core.Utilities.SoftwareInstallation
import
workingArea
from
DIRAC.Core.Utilities.Subprocess
import
systemCall
args
=
Script
.
getPositionalArgs
()
version
=
args
[
0
]
CorsikaSimtelPack
=
'
corsika_simhessarray/
'
+
version
+
'
/corsika_simhessarray
'
packs
=
[
CorsikaSimtelPack
]
for
package
in
packs
:
DIRAC
.
gLogger
.
notice
(
'
Checking:
'
,
package
)
if
sharedArea
:
if
checkSoftwarePackage
(
package
,
sharedArea
()
)[
'
OK
'
]:
DIRAC
.
gLogger
.
notice
(
'
Package found in Shared Area:
'
,
package
)
installSoftwareEnviron
(
package
,
workingArea
()
)
packageTuple
=
package
.
split
(
'
/
'
)
corsika_subdir
=
sharedArea
()
+
'
/
'
+
packageTuple
[
0
]
+
'
/
'
+
version
cmd
=
'
cp -u -r
'
+
corsika_subdir
+
'
/* .
'
os
.
system
(
cmd
)
continue
if
workingArea
:
if
checkSoftwarePackage
(
package
,
workingArea
()
)[
'
OK
'
]:
DIRAC
.
gLogger
.
notice
(
'
Package found in Local Area:
'
,
package
)
continue
if
installSoftwarePackage
(
package
,
workingArea
()
)[
'
OK
'
]:
############## compile #############################
if
version
==
'
clean_23012012
'
:
cmdTuple
=
[
'
./build_all
'
,
'
ultra
'
,
'
qgs2
'
]
elif
version
in
[
'
prod-2_21122012
'
,
'
prod-2_08032013
'
,
'
prod-2_06052013
'
]:
cmdTuple
=
[
'
./build_all
'
,
'
prod2
'
,
'
qgs2
'
]
ret
=
systemCall
(
0
,
cmdTuple
,
sendOutput
)
if
not
ret
[
'
OK
'
]:
DIRAC
.
gLogger
.
error
(
'
Failed to compile
'
)
DIRAC
.
exit
(
-
1
)
continue
DIRAC
.
gLogger
.
error
(
'
Check Failed for software package:
'
,
package
)
DIRAC
.
gLogger
.
error
(
'
Software package not available
'
)
DIRAC
.
exit
(
-
1
)
ret
=
getSoftwareEnviron
(
CorsikaSimtelPack
)
if
not
ret
[
'
OK
'
]:
error
=
ret
[
'
Message
'
]
DIRAC
.
gLogger
.
error
(
error
,
CorsikaSimtelPack
)
DIRAC
.
exit
(
-
1
)
corsikaEnviron
=
ret
[
'
Value
'
]
executable_file
=
args
[
1
]
cmd
=
'
chmod u+x
'
+
executable_file
os
.
system
(
cmd
)
cmdTuple
=
args
[
1
:]
DIRAC
.
gLogger
.
notice
(
'
Executing command tuple:
'
,
cmdTuple
)
ret
=
systemCall
(
0
,
cmdTuple
,
sendOutput
,
env
=
corsikaEnviron
)
if
not
ret
[
'
OK
'
]:
DIRAC
.
gLogger
.
error
(
'
Failed to execute read_hess:
'
,
ret
[
'
Message
'
]
)
DIRAC
.
exit
(
-
1
)
status
,
stdout
,
stderr
=
ret
[
'
Value
'
]
if
status
:
DIRAC
.
gLogger
.
error
(
'
read_hess execution reports Error:
'
,
status
)
DIRAC
.
gLogger
.
error
(
stdout
)
DIRAC
.
gLogger
.
error
(
stderr
)
DIRAC
.
exit
(
-
1
)
DIRAC
.
exit
()
def
sendOutput
(
stdid
,
line
):
DIRAC
.
gLogger
.
notice
(
line
)
if
__name__
==
'
__main__
'
:
try
:
main
()
except
Exception
:
DIRAC
.
gLogger
.
exception
()
DIRAC
.
exit
(
-
1
)
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