Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
ef926972
Commit
ef926972
authored
Jul 17, 2017
by
Matthieu Muffato
Browse files
Added a "hivestatus" role that prints the text with the same colour as beekeeper/guiHive
parent
b8c335e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
docs/user_manual/conf.py
docs/user_manual/conf.py
+6
-1
docs/user_manual/quickstart/quickstart.rst
docs/user_manual/quickstart/quickstart.rst
+1
-1
docs/user_manual/xhive.py
docs/user_manual/xhive.py
+40
-0
No files found.
docs/user_manual/conf.py
View file @
ef926972
...
...
@@ -21,7 +21,7 @@ import sphinx_rtd_theme
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'.'
))
from
xhive
import
hive_setup_if_needed
,
HiveDiagramDirective
from
xhive
import
*
hive_setup_if_needed
()
...
...
@@ -355,3 +355,8 @@ epub_exclude_files = ['search.html']
def
setup
(
app
):
app
.
add_stylesheet
(
"theme_overrides.css"
)
app
.
add_directive
(
'hive_diagram'
,
HiveDiagramDirective
)
app
.
add_role
(
'hivestatus'
,
hivestatus_role
)
app
.
add_node
(
hivestatus
,
html
=
(
visit_hivestatus_html
,
depart_hivestatus_html
),
latex
=
(
visit_hivestatus_latex
,
depart_hivestatus_latex
),
)
docs/user_manual/quickstart/quickstart.rst
View file @
ef926972
...
...
@@ -135,7 +135,7 @@ Making sense of the beekeeper's output
#. The status of the analysis (typically, "LOADING", "READY", "ALL_CLAIMED", possibly "FAILED"). Analyses that are done are not shown in this table.
#. A job summary, showing the number of [r]eady, [s]emaphored, [i]n-progress, and [d]one jobs in the analysis
#. A job summary, showing the number of [r]eady, [s]emaphored,
:hivestatus:`<INPROGRESS>
[i]n-progress
`
, and [d]one jobs in the analysis
#. Average runtime for jobs in the analysis,
...
...
docs/user_manual/xhive.py
View file @
ef926972
...
...
@@ -9,6 +9,8 @@ from docutils import nodes
from
docutils.parsers.rst
import
directives
from
docutils.parsers.rst
import
Directive
__all__
=
[
"HiveDiagramDirective"
,
"hive_setup_if_needed"
,
"hivestatus"
,
"hivestatus_role"
,
"visit_hivestatus_html"
,
"depart_hivestatus_html"
,
"visit_hivestatus_latex"
,
"depart_hivestatus_latex"
]
class
HiveDiagramDirective
(
Directive
):
# defines the parameter the directive expects
...
...
@@ -96,6 +98,7 @@ def generate_diagram(pipeconfig_content, target_image_filename):
os
.
remove
(
json_fh
.
name
)
os
.
remove
(
pipeconfig_fh
.
name
)
hive_colours
=
{}
def
hive_setup_if_needed
():
if
os
.
environ
.
get
(
"READTHEDOCS"
,
None
)
==
"True"
:
...
...
@@ -108,4 +111,41 @@ def hive_setup_if_needed():
if
True
or
any
(
not
os
.
path
.
exists
(
os
.
path
.
join
(
doxygen_target
,
_
))
for
_
in
[
"perl"
,
"python3"
,
"java"
]):
mkdoc_path
=
os
.
path
.
join
(
os
.
environ
[
"EHIVE_ROOT_DIR"
],
"scripts"
,
"make_docs.pl"
)
subprocess
.
call
([
mkdoc_path
,
"-no_schema_desc"
])
# eHive's default configuration file
default_config_file
=
os
.
environ
[
"EHIVE_ROOT_DIR"
]
+
os
.
path
.
sep
+
"hive_config.json"
with
open
(
default_config_file
,
"r"
)
as
fc
:
conf_content
=
json
.
load
(
fc
)
as_hash
=
conf_content
[
"Graph"
][
"Node"
][
"AnalysisStatus"
]
for
s
in
as_hash
:
if
isinstance
(
as_hash
[
s
],
dict
):
hive_colours
[
s
]
=
as_hash
[
s
][
"Colour"
]
js_hash
=
conf_content
[
"Graph"
][
"Node"
][
"JobStatus"
]
for
s
in
js_hash
:
if
isinstance
(
js_hash
[
s
],
dict
):
hive_colours
[
s
]
=
js_hash
[
s
][
"Colour"
]
class
hivestatus
(
nodes
.
Element
):
pass
def
hivestatus_role
(
name
,
rawtext
,
text
,
lineno
,
inliner
,
options
=
{},
content
=
[]):
status
=
text
[
1
:
text
.
index
(
'>'
)]
text
=
(
text
[
text
.
index
(
'>'
)
+
1
:]).
strip
()
hivestatus_node
=
hivestatus
()
hivestatus_node
.
children
.
append
(
nodes
.
Text
(
text
))
hivestatus_node
[
'status'
]
=
status
return
[
hivestatus_node
],
[]
def
visit_hivestatus_html
(
self
,
node
):
self
.
body
.
append
(
'<span style="background-color:%s">'
%
hive_colours
[
node
[
'status'
]])
def
depart_hivestatus_html
(
self
,
node
):
self
.
body
.
append
(
'</span>'
)
def
visit_hivestatus_latex
(
self
,
node
):
self
.
body
.
append
(
'
\n\\
colorbox{%s}{'
%
hive_colours
[
node
[
'status'
]])
def
depart_hivestatus_latex
(
self
,
node
):
self
.
body
.
append
(
'}'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment