Skip to content

Commit

Permalink
Draft slide decks for parts 1 and 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Jul 8, 2016
1 parent c5f1610 commit 9d533d0
Show file tree
Hide file tree
Showing 19 changed files with 1,368 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/programmers/tutorials/bottom-up/gc3.sty
Expand Up @@ -71,7 +71,7 @@
procnamestyle=\bfseries\color{BrickRed},%
procnamekeys={def},%
stringstyle=\color{MidnightBlue},%
showstringspaces=true,%
showstringspaces=false,%
emph={self},%
emphstyle=\bfseries\color{gray},%
% --- escaping and special displays ---
Expand Down
11 changes: 11 additions & 0 deletions docs/programmers/tutorials/index.rst
Expand Up @@ -32,6 +32,17 @@ to extend and adapt the examples provided.
A presentation of the training material and outline of the course.
Probably not much useful unless you're actually sitting in class.

`Overview of GC3Pie use cases <https://github.com/uzh/gc3pie/tree/training-july-2016/docs/programmers/tutorials/workflows/part01.pdf>`_

A quick overview of the kind of computational use cases that GC3Pie
can easily solve.

`GC3Pie basics <https://github.com/uzh/gc3pie/tree/training-july-2016/docs/programmers/tutorials/workflows/part02.pdf>`_

The basics needed to write simple GC3Pie scripts: the minimal
session-based script scaffolding, and the properties and features of
the `Application`:class: object.


A bottom-up introduction to programming with GC3Pie
---------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions docs/programmers/tutorials/workflows/day1.py
@@ -0,0 +1,19 @@
#! /usr/bin/env python

import os
import sys

from gc3libs.cmdline import SessionBasedScript

if __name__ == '__main__':
from day1 import AScript
AScript().run()

class AScript(SessionBasedScript):
"""
Minimal workflow scaffolding.
"""
def __init__(self):
super(AScript, self).__init__(version='1.0')
def new_tasks(self, extra):
return []
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/programmers/tutorials/workflows/gc3.sty
Expand Up @@ -71,7 +71,7 @@
procnamestyle=\bfseries\color{BrickRed},%
procnamekeys={def},%
stringstyle=\color{MidnightBlue},%
showstringspaces=true,%
showstringspaces=false,%
emph={self},%
emphstyle=\bfseries\color{gray},%
% --- escaping and special displays ---
Expand Down
16 changes: 16 additions & 0 deletions docs/programmers/tutorials/workflows/grayscale_app.py
@@ -0,0 +1,16 @@
from gc3libs import Application

class GrayscaleApp(Application):
"""Convert an image file to grayscale."""
def __init__(self, img):
inp = basename(img)
out = "gray-" + inp
Application.__init__(
self,
arguments=[
"convert", inp, "-colorspace", "gray", out],
inputs=[img],
outputs=[out],
output_dir="grayscale.d",
stdout="stdout.txt",
stderr="stderr.txt")
Binary file added docs/programmers/tutorials/workflows/lena.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions docs/programmers/tutorials/workflows/make_state_graph.py
@@ -0,0 +1,31 @@
#! /usr/bin/env python

from graphviz import Digraph

desc = [#('UNKNOWN', ()),
('NEW', ('SUBMITTED', 'RUNNING')),
('SUBMITTED', ('RUNNING',)),
('RUNNING', ('TERMINATING', 'STOPPED',)),
('TERMINATING', ('TERMINATED',)),
('TERMINATED', ()),
('STOPPED', ())]

for n in range(len(desc)):
refstate = desc[n][0]
g = Digraph(comment='GC3Pie Application states: ' + refstate)
for k, (state, transitions) in enumerate(desc):
attrs = { 'shape': 'box' }
if not transitions and state != 'UNKNOWN':
attrs['rank'] = 'max'
attrs['shape'] = 'house'
if n == k:
attrs['style'] = 'filled'
attrs['fillcolor'] = 'antiquewhite'
g.node(state, **attrs)
for next_state in transitions:
g.edge(state, next_state)
#if state != 'UNKNOWN':
# g.edge(state, 'UNKNOWN', constraint='false')

out = 'states-' + refstate
g.render(out, view=False, cleanup=True)
Binary file added docs/programmers/tutorials/workflows/part01.pdf
Binary file not shown.
146 changes: 146 additions & 0 deletions docs/programmers/tutorials/workflows/part01.tex
@@ -0,0 +1,146 @@
\documentclass[english,serif,mathserif,xcolor=pdftex,dvipsnames,table]{beamer}
\usetheme{gc3}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}

\usepackage{gc3}

\title[Introduction]{%
Overview of common GC3Pie use cases
}
\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{What is GC3Pie?}
GC3Pie is \ldots
\begin{enumerate}
\item \alert<1>{An \emph{opinionated} Python framework for defining and running computational workflows;}
\item A \emph{rapid development toolkit} for running user applications on clusters and IaaS cloud resources;
\item The worst name ever given to a middleware piece\ldots
\end{enumerate}

\+
As \emph{developers}, \alert<1>{you're mostly interested in this part.}
\end{frame}


\begin{frame}[fragile]
\frametitle{Uses of GC3Pie: parameter sweep}

You have a simulation code that is dependent on a number of parameters.

\+
Run the code for all possible combinations of parameters.

\+
Then collect all the outputs and post-process to get a
statistical overview.
\end{frame}


\begin{frame}[fragile]
\frametitle{Uses of GC3Pie: model calibration}

You have a simulation code that is dependent on a number of parameters.

\+
Run the code for all possible combinations of parameters, and
find the ones that ``best'' approximate a given experimental result.
\end{frame}


\begin{frame}[fragile]
\frametitle{Uses of GC3Pie: parallel processing}

Run the same program over and over again,
feeding it different input files each time.

\+
Then collect all the outputs and post-process to get a
statistical overview.
\end{frame}


\begin{frame}[fragile]
\frametitle{Uses of GC3Pie: parallel processing}
(At times, you chop a large input file into pieces and process each one separately instead.)

\+
\begin{quote}
``For example, say we have a de novo assembly of 100,000
contigs. If we run 1 BLAST job against NR it could take as long as
50,000 minutes/35 days!! (30sec/query sequence), however if we
split this job into subsets of 5,000 sequences and ran 20 jobs in
"parallel" on a cluster, our total run-time is reduced to only 41
hours.''
\end{quote}
\begin{references}
\url{http://sfg.stanford.edu/BLAST.html}
\end{references}
\end{frame}


\begin{frame}
\frametitle{Uses of GC3Pie: workflows}

\begin{center}
Orchestrate execution of several applications:
some steps may run in parallel, some might need to be sequenced.

\+
\includegraphics[width=0.70\textwidth]{fig/warholize-wkf}
\end{center}
\end{frame}


\begin{frame}
\frametitle{A typical high-throughput script structure}

\begin{enumerate}
\item Initialize computational resources
\item Prepare programs and inputs for submission
\item Submit tasks
\item Monitor task status (loop)
\item Retrieve results
\item Postprocess and display
\end{enumerate}
\end{frame}


\begin{frame}
\frametitle{What GC3Pie handles for you}

\begin{enumerate}\small
\item Resource allocation (e.g. starting new instances on
ScienceCloud)
\item Selection of resources for each application in the session
\item Data transfer (e.g. copying input files in the new instances)
\item Remote execution of the application
\item Retrieval of results (e.g. copying output files from the
running instance)
\item De-allocation of resources
\end{enumerate}

\end{frame}


\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Binary file added docs/programmers/tutorials/workflows/part02.pdf
Binary file not shown.

0 comments on commit 9d533d0

Please sign in to comment.