-
Notifications
You must be signed in to change notification settings - Fork 23
/
part07.tex
241 lines (167 loc) · 5.61 KB
/
part07.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
\documentclass[english,serif,mathserif,xcolor=pdftex,dvipsnames,table]{beamer}
\usetheme{gc3}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{gc3}
\title[Workflows]{%
Introduction to workflows with GC3Pie
}
\author[R. Murri, S3IT UZH]{%
Riccardo Murri \texttt{<riccardo.murri@uzh.ch>}
\\[1ex]
\emph{S3IT: Services and Support for Science IT}
\\[1ex]
University of Zurich
}
\date{July~11--14, 2016}
\begin{document}
% title frame
\maketitle
% \begin{frame}
% \frametitle{The GC3Pie approach to workflows, I}
% \begin{center}
% Workflows are Python code.
% \end{center}
% \end{frame}
% \begin{frame}
% \frametitle{The GC3Pie approach to workflows, II}
% Thus, in order to run a workflow, you write a Python script using
% GC3Pie to orchestrate the running of applications.
% \end{frame}
\begin{frame}
So far we've seen how to write scripts that control many instances of
a single application.
\+
Now it's time to introduce the GC3Pie classes that allow
orchestrating the execution of jobs of several different types. (For
instance, specify that certain applications should be executed in a
sequence.)
\+
Let's start with a colorful example.
\end{frame}
\begin{frame}
\frametitle{Warholize!}
\begin{tabular}[c]{ccc}
\includegraphics[width=0.4\textwidth]{fig/butterfly.jpg}
&
{\includegraphics[width=0.1\linewidth,totalheight=0.25\textheight]{fig/arrow.pdf}}
&
\includegraphics[width=0.4\textwidth]{fig/warholized-butterfly.jpg}
\end{tabular}
\end{frame}
\begin{frame}[fragile]
How do we ``warholize'' an arbitrary image?
\+
\begin{enumerate}
\item Convert the original image to grayscale.
\item Colorize the grayscale image using three different colors for each tile.
\item Arrange all the colorized images into an $N\times N$ frame.
\end{enumerate}
\+
\begin{references}
\url{http://gc3pie.readthedocs.io/en/master/programmers/tutorials/index.html#warholize-tutorial}
\end{references}
\end{frame}
\begin{frame}
\frametitle{The GC3Pie approach to workflows, II}
The basic unit of work in a GC3Pie workflow is called a \texttt{Task}.
\+
The \texttt{Application} class that you already know is a kind of
\texttt{Task} (indeed, it's a derived class).
\+
From now on, we'll speak of \texttt{Task}s rather than
applications. Examples of \texttt{Task} instances that are not
applications will arrive shortly.
\end{frame}
\begin{frame}
\frametitle{Running tasks in sequence}
To run tasks in an ordered sequence, one after the other, GC3Pie
provides a \texttt{SequentialTaskCollection} class.
\+
It is created with a list of tasks, and runs all of them in the
order given. The sequence is dynamic, in that you can add new tasks
on the fly, re-run existing ones, or remove future tasks.
\+
A \texttt{SequentialTaskCollection} is itself a task.
\end{frame}
\begin{frame}
\frametitle{Running tasks in parallel}
To run tasks in parallel (i.e., they have no inter-dependency),
GC3Pie provides a \texttt{ParallelTaskCollection} class.
\+
It is created with a (Python) list of tasks, and runs all of them
in parallel (compatibly with the computational resource limits).
\+
A \texttt{ParallelTaskCollection} is itself a task.
\end{frame}
\begin{frame}
\frametitle{Putting it all together}
So tasks can be:
\begin{itemize}
\item \texttt{Application} instances,
\item \texttt{SequentialTaskCollection}s,
\item \texttt{ParallelTaskCollection}s.
\end{itemize}
\+
So you can nest them, and create parallelly-running sequences, or
sequences of ``job explosions'' (many jobs in parallel), or any
combination of this.
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, I}
1. Convert the original image to grayscale.
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-wkf1}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, II}
2. Colorize the grayscale image using three different colors for each tile.
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-wkf2}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, III}
3. Arrange all the colorized images into an $N\times N$ frame.
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-wkf3}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, IV}
Step 2 actually entails two sub-steps:
\begin{enumerate}[a)]
\item mapping greyscale levels to random colors,
\item applying this mapping to produce new images
\end{enumerate}
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-wkf2a}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, V}
So, Step~2 is a \texttt{SequentialTaskCollection}-type task. Let's
call this two-pass sequence \texttt{TricolorizeImage} .
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-TricolorizeImage}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, VI}
All the \texttt{TricolorizeImage} instances run in parallel. Collect
them into a \texttt{ParallelTaskCollection}-type task, called
\texttt{TricolorizeMultipleImages}.
\+
\includegraphics[width=0.75\textwidth]{fig/warholize-TricolorizeMultipleImages}
\end{frame}
\begin{frame}
\frametitle{The Warholize workflow, VII}
Now we are left with a three-step sequence: greyscale,
\texttt{TricolorizeMultipleImages}, montage. This can be defined
again as a \texttt{SequentialTaskCollection}-type task, the
\texttt{WarholizeWorkflow}.
\+
\includegraphics[width=0.70\textwidth]{fig/warholize-WarholizeWorkflow}
\end{frame}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End: