Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
38ccb6c0
Commit
38ccb6c0
authored
15 years ago
by
Ger van Diepen
Browse files
Options
Downloads
Patches
Plain Diff
bug 1385:
Added the possibility to create the FLAG column in another table and forward it.
parent
8efd4f30
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RTCP/LofarStMan/src/makeFLAGwritable
+37
-8
37 additions, 8 deletions
RTCP/LofarStMan/src/makeFLAGwritable
with
37 additions
and
8 deletions
RTCP/LofarStMan/src/makeFLAGwritable
+
37
−
8
View file @
38ccb6c0
...
@@ -32,7 +32,7 @@ import sys
...
@@ -32,7 +32,7 @@ import sys
# Note that first renaming FLAG to, say, FLAGOLD does not work because
# Note that first renaming FLAG to, say, FLAGOLD does not work because
# LofarStMan does not know FLAGOLD.
# LofarStMan does not know FLAGOLD.
def
makeFlagWritable
(
msname
):
def
makeFlagWritable
(
msname
,
flagtablename
):
ms
=
pt
.
table
(
msname
,
readonly
=
False
)
ms
=
pt
.
table
(
msname
,
readonly
=
False
)
# Only add if a cell is defined but cannot be written.
# Only add if a cell is defined but cannot be written.
add
=
False
add
=
False
...
@@ -44,9 +44,22 @@ def makeFlagWritable (msname):
...
@@ -44,9 +44,22 @@ def makeFlagWritable (msname):
if
add
:
if
add
:
shape
=
ms
.
getcell
(
'
FLAG
'
,
0
).
shape
shape
=
ms
.
getcell
(
'
FLAG
'
,
0
).
shape
# Define the data manager to be used.
# Define the data manager to be used.
dminfo
=
{
'
*1
'
:
{
'
TYPE
'
:
'
StandardStMan
'
,
'
NAME
'
:
'
SSMFlag
'
,
'
SPEC
'
:{
'
BUCKETSIZE
'
:
32768
}}}
dminfo
=
{
'
*1
'
:
{
'
TYPE
'
:
'
StandardStMan
'
,
# Add a column and make it Direct,FixedShape.
'
NAME
'
:
'
SSMFlag
'
,
ms
.
addcols
(
pt
.
maketabdesc
(
pt
.
makearrcoldesc
(
"
FLAG__TMP
"
,
False
,
options
=
5
,
shape
=
shape
)),
dminfo
)
'
SPEC
'
:{
'
BUCKETSIZE
'
:
32768
}}}
# Make a column description with option Direct,FixedShape.
tabdesc
=
pt
.
maketabdesc
(
pt
.
makearrcoldesc
(
"
FLAG__TMP
"
,
False
,
options
=
5
,
shape
=
shape
))
if
len
(
flagtablename
)
>
0
:
# Create the table to contain the flags
flagtab
=
pt
.
table
(
flagtablename
,
tabdesc
,
ms
.
nrows
(),
dminfo
=
dminfo
)
flagtab
.
flush
()
dminfo
=
{
'
*1
'
:
{
'
TYPE
'
:
'
ForwardColumnEngine
'
,
'
NAME
'
:
'
ForwardFlag
'
,
'
SPEC
'
:{
'
FORWARDTABLE
'
:
flagtablename
}}}
# Add the column to the MS.
ms
.
addcols
(
tabdesc
,
dminfo
)
print
'
Created new FLAG column; copying old values ...
'
print
'
Created new FLAG column; copying old values ...
'
# Copy the flags.
# Copy the flags.
t
=
pt
.
taql
(
'
update %s set FLAG__TMP = FLAG
'
%
msname
)
t
=
pt
.
taql
(
'
update %s set FLAG__TMP = FLAG
'
%
msname
)
...
@@ -54,19 +67,35 @@ def makeFlagWritable (msname):
...
@@ -54,19 +67,35 @@ def makeFlagWritable (msname):
# Remove the old column and rename the new one.
# Remove the old column and rename the new one.
ms
.
removecols
(
'
FLAG
'
)
ms
.
removecols
(
'
FLAG
'
)
ms
.
renamecol
(
'
FLAG__TMP
'
,
'
FLAG
'
)
ms
.
renamecol
(
'
FLAG__TMP
'
,
'
FLAG
'
)
print
'
FLAG column now stored with SSM to make it writable
'
ms
.
flush
()
if
len
(
flagtablename
)
==
0
:
print
'
FLAG column now stored with SSM to make it writable
'
else
:
flagtab
=
pt
.
table
(
flagtablename
,
readonly
=
False
)
flagtab
.
renamecol
(
'
FLAG__TMP
'
,
'
FLAG
'
)
flagtab
.
flush
()
print
'
FLAG column now forwarded to table
'
,
flagtablename
else
:
else
:
print
'
FLAG column is already writable
'
print
'
FLAG column is already writable
'
ms
.
flush
()
def
main
(
argv
=
None
):
def
main
(
argv
=
None
):
if
argv
is
None
:
if
argv
is
None
:
argv
=
sys
.
argv
argv
=
sys
.
argv
if
len
(
argv
)
<
2
:
if
len
(
argv
)
<
2
:
print
'
run as: makeFLAGwritable msname
'
print
'
run as: makeFLAGwritable msname [flagtablename]
'
print
'
If column FLAG in the given MS is not writable, it will replace
'
print
'
by a writable FLAG column and copy the current values.
'
print
'
If a flagtable name is given, it will create that table with a
'
print
'
FLAG column and forward the FLAG column in the MS to it.
'
print
'
In this way the flags can be written on the compute node disk
'
print
'
instead of the storage node disk.
'
print
'
If no flagtable name is given, it will add a normal FLAG column.
'
return
1
return
1
makeFlagWritable
(
argv
[
1
])
flagtablename
=
''
if
len
(
argv
)
>
2
:
flagtablename
=
argv
[
2
]
makeFlagWritable
(
argv
[
1
],
flagtablename
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
sys
.
exit
(
main
())
sys
.
exit
(
main
())
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