Skip to content

Commit 0674454

Browse files
committed
📝 Document changes needed to version-specific files
1 parent fcdcb85 commit 0674454

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

docs/_sources/developer/deprecating.rst

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,79 @@ To semiautomatically deprecate a published version of C-PAC, follow these steps:
1414
In a local clone or copy of |CPAC-Development|_:
1515

1616
#. Replace the critical alert in |CRITICAL_ALERT.rst|_ with the ``CRITICAL_ALERT`` from step one, above.
17+
#. Update |cpac_pipeline.py|_ and |run.py|_:
18+
#. Overwrite the current versions in the |CPAC-Development/deprecate|_ with the versions from the source code of the version of C-PAC to deprecate.
19+
#. Add
20+
21+
.. code:: Python
22+
23+
shutil.copyfile('/CRITICAL_ALERT.rst',
24+
os.path.join(log_dir, 'CRITICAL_ALERT.rst'))
25+
26+
to |cpac_pipeline.py|_ after
27+
28+
.. code:: Python
29+
30+
if not os.path.exists(log_dir):
31+
os.makedirs(os.path.join(log_dir))
32+
33+
(e.g., |cpac_pipeline.py example 1|_) and make sure ``shutil`` is imported before calling that library.
34+
35+
#. Also in |cpac_pipeline.py|_, update the variable ``execution_info`` to include ``{critical_alert}`` at the end, like |cpac_pipeline.py example 2|_:
36+
37+
.. code:: Python
38+
39+
execution_info = """
40+
41+
End of subject workflow {workflow}
42+
43+
CPAC run complete:
44+
45+
Pipeline configuration: {pipeline}
46+
Subject workflow: {workflow}
47+
Elapsed run time (minutes): {elapsed}
48+
Timing information saved in {log_dir}/cpac_individual_timing_{pipeline}.csv
49+
System time of start: {run_start}
50+
System time of completion: {run_finish}
51+
52+
{critical_alert}
53+
"""
54+
55+
.. note::
56+
57+
There are probably at least two definitions of ``execution_info`` that need ``{critical_alert}`` appended to them (e.g., |cpac_pipeline.py example 3|_).
58+
59+
#. Also in |cpac_pipeline.py|_, define ``critical_alert`` based on the |CRITICAL_ALERT.rst|_ file you already updated (e.g., |cpac_pipeline.py example 4|_):
60+
61+
.. code:: Python
62+
63+
with open('/CRITICAL_ALERT.rst', 'r') as critical_alert_file:
64+
critical_alert = '\n'.join([
65+
f' {line.rstrip()}' for line in critical_alert_file.readlines()])
66+
67+
#. Also in |cpac_pipeline.py|_, update any calls to ``execution_info.format()`` to populate the string variable ``{critical_alert}`` with the ``critical_alert`` you defined above (e.g., |cpac_pipeline.py example 5|_):
68+
69+
.. code:: Python
70+
71+
logger.info(execution_info.format(
72+
workflow=workflow.name,
73+
pipeline=c.pipeline_setup['pipeline_name'],
74+
log_dir=c.pipeline_setup['log_directory']['path'],
75+
elapsed=(time.time() - pipeline_start_time) / 60,
76+
run_start=pipeline_start_datetime,
77+
run_finish=strftime("%Y-%m-%d %H:%M:%S"),
78+
critical_alert=critical_alert
79+
))
80+
81+
#. In |run.py|_, print the contents of |CRITICAL_ALERT.rst|_, e.g. |run.py example 1|_:
82+
83+
.. code:: Python
84+
85+
with open('/CRITICAL_ALERT.rst', 'r') as critical_alert_file:
86+
critical_alert = critical_alert_file.read()
87+
88+
print(critical_alert)
89+
1790
#. From the ``deprecate`` subdirectory, run
1891

1992
.. code:: BASH
@@ -66,10 +139,42 @@ To semiautomatically deprecate a published version of C-PAC, follow these steps:
66139

67140
.. _CPAC-Development/deprecate: https://github.com/FCP-INDI/CPAC-Development/tree/028e7929188df99241e8eea78d20d0fd27dbe509/deprecate
68141

142+
.. |cpac_pipeline.py| replace:: ``cpac_pipeline.py``
143+
144+
.. _cpac_pipeline.py: https://github.com/FCP-INDI/CPAC-Development/blob/DEPRECATE/deprecate/cpac_pipeline.py
145+
146+
.. |cpac_pipeline.py example 1| replace:: ``cpac_pipeline.py#L264-L265@bc6081c``
147+
148+
.. _cpac_pipeline.py example 1: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/cpac_pipeline.py#L264-L265
149+
150+
.. |cpac_pipeline.py example 2| replace:: ``cpac_pipeline.py#L370@bc6081c``
151+
152+
.. _cpac_pipeline.py example 2: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/cpac_pipeline.py#L370
153+
154+
.. |cpac_pipeline.py example 3| replace:: ``cpac_pipeline.py#L705@bc6081c``
155+
156+
.. _cpac_pipeline.py example 3: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/cpac_pipeline.py#L705
157+
158+
.. |cpac_pipeline.py example 4| replace:: ``cpac_pipeline.py#L373-L375@bc6081c``
159+
160+
.. _cpac_pipeline.py example 4: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/cpac_pipeline.py#L373-L375
161+
162+
.. |cpac_pipeline.py example 5| replace:: ``cpac_pipeline.py#L722@bc6081c``
163+
164+
.. _cpac_pipeline.py example 5: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/cpac_pipeline.py#L722
165+
69166
.. |Docker Hub tags| replace:: fcpindi/c-pac Tags | Docker Hub
70167

71168
.. _Docker Hub tags: https://hub.docker.com/repository/docker/fcpindi/c-pac/tags
72169

170+
.. |run.py| replace:: ``run.py``
171+
172+
.. _run.py: https://github.com/FCP-INDI/CPAC-Development/blob/DEPRECATE/deprecate/run.py
173+
174+
.. |run.py example 1| replace:: ``run.py#L216-L219@bc6081c``
175+
176+
.. _run.py example 1: https://github.com/FCP-INDI/CPAC-Development/blob/bc6081c/deprecate/run.py#L216-L219
177+
73178
.. |semver| raw:: HTML
74179

75180
<span title="semantic version">semver</span>

0 commit comments

Comments
 (0)