[Swift-commit] r4831 - in trunk: docs docs/siteguide docs/tutorial examples examples/misc examples/tutorial tests tests/documentation tests/documentation/tutorial tests/groups
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Tue Jul 19 15:23:50 CDT 2011
Author: davidk
Date: 2011-07-19 15:23:41 -0500 (Tue, 19 Jul 2011)
New Revision: 4831
Added:
trunk/docs/print_link.sh
trunk/docs/siteguide/
trunk/docs/siteguide/beagle
trunk/docs/siteguide/futuregrid
trunk/docs/siteguide/pads
trunk/docs/siteguide/siteguide.html
trunk/docs/siteguide/siteguide.txt
trunk/docs/tutorial/abstract
trunk/docs/tutorial/bits
trunk/docs/tutorial/hello_world
trunk/docs/tutorial/images/
trunk/docs/tutorial/introduction
trunk/docs/tutorial/language_features
trunk/docs/tutorial/runtime_features
trunk/docs/tutorial/tutorial.html
trunk/docs/tutorial/tutorial.txt
trunk/examples/misc/
trunk/examples/misc/array_index.swift
trunk/examples/misc/array_wildcard.swift
trunk/examples/misc/catsn.swift
trunk/examples/misc/hostsn.swift
trunk/examples/tutorial/
trunk/examples/tutorial/MyFirstMapper.java
trunk/examples/tutorial/arrays.swift
trunk/examples/tutorial/capitalise.swift
trunk/examples/tutorial/capitalise_anonymous.swift
trunk/examples/tutorial/default.swift
trunk/examples/tutorial/fixed_array_mapper.1.txt
trunk/examples/tutorial/fixed_array_mapper.2.txt
trunk/examples/tutorial/fixed_array_mapper.3.txt
trunk/examples/tutorial/fixed_array_mapper.swift
trunk/examples/tutorial/foreach.1.txt
trunk/examples/tutorial/foreach.2.txt
trunk/examples/tutorial/foreach.3.txt
trunk/examples/tutorial/foreach.swift
trunk/examples/tutorial/hello.swift
trunk/examples/tutorial/if.swift
trunk/examples/tutorial/manyparam.swift
trunk/examples/tutorial/my_first_mapper.swift
trunk/examples/tutorial/one.txt
trunk/examples/tutorial/parameter.swift
trunk/examples/tutorial/regexp_mapper.swift
trunk/examples/tutorial/regexp_mapper.words.txt
trunk/examples/tutorial/restart.swift
trunk/examples/tutorial/sequential_iteration.swift
trunk/examples/tutorial/three.txt
trunk/examples/tutorial/two.txt
trunk/examples/tutorial/types.swift
trunk/examples/tutorial/wcl
trunk/examples/tutorial/words.txt
trunk/tests/documentation/tutorial/
trunk/tests/documentation/tutorial/arrays.clean.sh
trunk/tests/documentation/tutorial/arrays.swift
trunk/tests/documentation/tutorial/arrays.txt.expected
trunk/tests/documentation/tutorial/capitalise.1.txt.expected
trunk/tests/documentation/tutorial/capitalise.2.txt.expected
trunk/tests/documentation/tutorial/capitalise.clean.sh
trunk/tests/documentation/tutorial/capitalise.swift
trunk/tests/documentation/tutorial/capitalise_anonymous.clean.sh
trunk/tests/documentation/tutorial/capitalise_anonymous.swift
trunk/tests/documentation/tutorial/capitalise_anonymous.txt.expected
trunk/tests/documentation/tutorial/default.1.txt.expected
trunk/tests/documentation/tutorial/default.2.txt.expected
trunk/tests/documentation/tutorial/default.clean.sh
trunk/tests/documentation/tutorial/default.swift
trunk/tests/documentation/tutorial/fixed_array_mapper.1.count.expected
trunk/tests/documentation/tutorial/fixed_array_mapper.2.count.expected
trunk/tests/documentation/tutorial/fixed_array_mapper.3.count.expected
trunk/tests/documentation/tutorial/fixed_array_mapper.clean.sh
trunk/tests/documentation/tutorial/fixed_array_mapper.setup.sh
trunk/tests/documentation/tutorial/fixed_array_mapper.swift
trunk/tests/documentation/tutorial/foreach.1.count.expected
trunk/tests/documentation/tutorial/foreach.2.count.expected
trunk/tests/documentation/tutorial/foreach.3.count.expected
trunk/tests/documentation/tutorial/foreach.clean.sh
trunk/tests/documentation/tutorial/foreach.setup.sh
trunk/tests/documentation/tutorial/foreach.swift
trunk/tests/documentation/tutorial/hello.clean.sh
trunk/tests/documentation/tutorial/hello.swift
trunk/tests/documentation/tutorial/hello.txt.expected
trunk/tests/documentation/tutorial/hello2.txt.expected
trunk/tests/documentation/tutorial/if.clean.sh
trunk/tests/documentation/tutorial/if.swift
trunk/tests/documentation/tutorial/if.txt.expected
trunk/tests/documentation/tutorial/manyparam.clean.sh
trunk/tests/documentation/tutorial/manyparam.english.txt.expected
trunk/tests/documentation/tutorial/manyparam.french.txt.expected
trunk/tests/documentation/tutorial/manyparam.japanese.txt.expected
trunk/tests/documentation/tutorial/manyparam.swift
trunk/tests/documentation/tutorial/parameter.clean.sh
trunk/tests/documentation/tutorial/parameter.hello.txt.expected
trunk/tests/documentation/tutorial/parameter.swift
trunk/tests/documentation/tutorial/regexp_mapper.clean.sh
trunk/tests/documentation/tutorial/regexp_mapper.setup.sh
trunk/tests/documentation/tutorial/regexp_mapper.swift
trunk/tests/documentation/tutorial/regexp_mapper.words.count.expected
trunk/tests/documentation/tutorial/sequential_iteration.clean.sh
trunk/tests/documentation/tutorial/sequential_iteration.foldout0000.expected
trunk/tests/documentation/tutorial/sequential_iteration.foldout0001.expected
trunk/tests/documentation/tutorial/sequential_iteration.foldout0002.expected
trunk/tests/documentation/tutorial/sequential_iteration.foldout0003.expected
trunk/tests/documentation/tutorial/sequential_iteration.setup.sh
trunk/tests/documentation/tutorial/sequential_iteration.swift
trunk/tests/documentation/tutorial/swift.properties
trunk/tests/documentation/tutorial/tc.template.data
trunk/tests/documentation/tutorial/title.txt
trunk/tests/documentation/tutorial/types.clean.sh
trunk/tests/documentation/tutorial/types.pies.txt.expected
trunk/tests/documentation/tutorial/types.swift
trunk/tests/groups/group-documentation.sh
Removed:
trunk/docs/newuser-guide/
trunk/docs/tutorial/abstract
trunk/docs/tutorial/bits
trunk/docs/tutorial/hello_world
trunk/docs/tutorial/images/
trunk/docs/tutorial/introduction
trunk/docs/tutorial/language_features
trunk/docs/tutorial/runtime_features
trunk/docs/tutorial/tutorial.txt
trunk/examples/anonymous.swift
trunk/examples/array_index.swift
trunk/examples/array_wildcard.swift
trunk/examples/catsn.swift
trunk/examples/default.swift
trunk/examples/first.swift
trunk/examples/fixedarray.swift
trunk/examples/foreach.swift
trunk/examples/hostsn.swift
trunk/examples/if.swift
trunk/examples/iterate.swift
trunk/examples/manyparam.swift
trunk/examples/one.txt
trunk/examples/parameter.swift
trunk/examples/q16.txt
trunk/examples/q21.swift
trunk/examples/q3.swift
trunk/examples/q5.swift
trunk/examples/q6.swift
trunk/examples/q7.swift
trunk/examples/regexp.swift
trunk/examples/restart.swift
trunk/examples/second_procedure.swift
trunk/examples/three.txt
trunk/examples/two.txt
trunk/examples/types.swift
trunk/examples/wcl
trunk/tests/documentation/3-1_hello_world.check.sh
trunk/tests/documentation/3-1_hello_world.clean.sh
trunk/tests/documentation/3-1_hello_world.swift
trunk/tests/documentation/4-1-2_many_parameters.check.sh
trunk/tests/documentation/4-1-2_many_parameters.clean.sh
trunk/tests/documentation/4-1-2_many_parameters.swift
trunk/tests/documentation/4-1_parameter.check.sh
trunk/tests/documentation/4-1_parameter.clean.sh
trunk/tests/documentation/4-1_parameter.swift
trunk/tests/documentation/4-2_adding_another_application.check.sh
trunk/tests/documentation/4-2_adding_another_application.clean.sh
trunk/tests/documentation/4-2_adding_another_application.swift
trunk/tests/documentation/4-4_datatypes.check.sh
trunk/tests/documentation/4-4_datatypes.clean.sh
trunk/tests/documentation/4-4_datatypes.swift
trunk/tests/documentation/4-5_arrays.check.sh
trunk/tests/documentation/4-5_arrays.clean.sh
trunk/tests/documentation/4-5_arrays.swift
trunk/tests/documentation/4-6-2_fixed_array_mapper.check.sh
trunk/tests/documentation/4-6-2_fixed_array_mapper.clean.sh
trunk/tests/documentation/4-6-2_fixed_array_mapper.setup.sh
trunk/tests/documentation/4-6-2_fixed_array_mapper.swift
trunk/tests/documentation/4-7_foreach.check.sh
trunk/tests/documentation/4-7_foreach.clean.sh
trunk/tests/documentation/4-7_foreach.swift
trunk/tests/documentation/4-9_sequential_iteration.check.sh
trunk/tests/documentation/4-9_sequential_iteration.clean.sh
trunk/tests/documentation/4-9_sequential_iteration.swift
trunk/tests/documentation/6-1_named_and_optional_params.check.sh
trunk/tests/documentation/6-1_named_and_optional_params.clean.sh
trunk/tests/documentation/6-1_named_and_optional_params.swift
trunk/tests/documentation/one.txt
trunk/tests/documentation/sites.template.xml
trunk/tests/documentation/swift.properties
trunk/tests/documentation/tc.data
trunk/tests/documentation/tc.template.data
trunk/tests/documentation/three.txt
trunk/tests/documentation/title.txt
trunk/tests/documentation/two.txt
Modified:
trunk/tests/groups/group-all-local.sh
trunk/tests/suite.sh
Log:
Compile various individual site guides into one document
Rename newuser-guide to siteguide
print_link script to generate links to correct version of user guide, tutorial, etc
Removed nearly all code fragments from tutorial. It now uses line numbers to do this. Eventually it should use some kind of tags for this.
The test suite now has tests using the actual scripts in the examples directory. The same files that get referenced in the guides are run through the test suite.
Removed the check scripts from the tutorial tests and use expected files
New directory structures (examples/tutorial and tests/documentation/tutorial)
Added: trunk/docs/print_link.sh
===================================================================
--- trunk/docs/print_link.sh (rev 0)
+++ trunk/docs/print_link.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# This script is referenced by asciidoc to point to the correct versions of documentation based on version information
+# print_info.sh <guide>
+# This will print the correct URL based on SVN version info
+
+pushd ../.. > /dev/null 2>&1
+VERSION=`svn info |grep URL|awk -F / '{print $NF}'`
+popd > /dev/null 2>&1
+
+# Parse command line arguments
+case "$1" in
+ userguide)
+ echo http://www.ci.uchicago.edu/swift/guides/$VERSION/userguide/userguide.html[Swift User Guide]
+ ;;
+ tutorial)
+ echo http://www.ci.uchicago.edu/swift/guides/$VERSION/tutorial/tutorial.html[Swift Tutorial]
+ ;;
+ *) echo http://www.ci.uchicago.edu/swift/docs/index.php[Swift Documentation]
+ ;;
+esac
Property changes on: trunk/docs/print_link.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/docs/siteguide/beagle
===================================================================
--- trunk/docs/siteguide/beagle (rev 0)
+++ trunk/docs/siteguide/beagle 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,49 @@
+Beagle
+------
+
+Requesting Access
+~~~~~~~~~~~~~~~~~
+If you do not already have a Computation Institute account, you can request
+one at https://www.ci.uchicago.edu/accounts/. This page will give you a list
+of resources you can request access to.
+You already have an existing CI account, but do not have access to Beagle,
+send an email to support at ci.uchicago.edu to request access.
+
+Connecting to a login node
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Once you have account, you should be able to access a Beagle login
+node with the following command:
+
+-----
+ssh yourusername at login.beagle.ci.uchicago.edu
+-----
+
+Follow the steps outlined below to get started with Swift on Beagle:
+
+*step 1.* Load the Swift module on Beagle as follows: +module load swift+
+
+*step 2.* Create and change to a directory where your Swift related work will
+stay. (say, +mkdir swift-lab+, followed by, +cd swift-lab+)
+
+*step 3.* To get started with a simple example running +/bin/cat+ to read an
+input file +data.txt+ and write to an output file +f.nnn.out+, copy the folder
+at +/home/ketan/catsn+ to the above directory. (+cp -r /home/ketan/catsn
+.+ followed by +cd catsn+).
+
+*step 4.* In the sites file: +beagle-coaster.xml+, make the following two
+changes: *1)* change the path of +workdirectory+ to your preferred location
+(say to +/lustre/beagle/$USER/swift-lab/swift.workdir+) and *2)* Change the
+project name to your project (+CI-CCR000013+) . The workdirectory will contain
+execution data related to each run, e.g. wrapper scripts, system information,
+inputs and outputs.
+
+*step 5.* Run the example using following commandline (also found in run.sh):
++swift -config cf -tc.file tc -sites.file beagle-coaster.xml catsn.swift -n=1+
+. You can further change the value of +-n+ to any arbitrary number to run that
+many number of concurrent +cat+
+
+*step 6.* Check the output in the generated +outdir+ directory (+ls outdir+)
+
+Note: Running from sandbox node or requesting 1 hour walltime for upto 3 nodes
+will get fast prioritized execution. Good for small tests.
+
Added: trunk/docs/siteguide/futuregrid
===================================================================
--- trunk/docs/siteguide/futuregrid (rev 0)
+++ trunk/docs/siteguide/futuregrid 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,134 @@
+Futuregrid Quickstart Guide
+---------------------------
+
+Downloading and Building Swift
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The most recent versions of Swift can be found at
+http://www.ci.uchicago.edu/swift/downloads/index.php. To run on futuregrid,
+you will need to download the development/trunk version from SVN.
+
+Adding Swift to your PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Once you have installed Swift, add the Swift binary to your PATH so you can
+easily run it from any directory.
+
+In your home directory, edit the file ".bashrc".
+
+If you have installed Swift via a source repository, add the following line
+at the bottom of .bashrc.
+
+-----
+export PATH=$PATH:$HOME/cog/modules/swift/dist/swift-svn/bin
+-----
+
+Requesting Futuregrid Access
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If you do not already have a futuregrid account, you can follow the
+instructions at https://portal.futuregrid.org/gettingstarted to get started.
+This page provides information on how to create an account, how to join
+a project, how to set up your SSH keys, and how to create a new project.
+
+Downloading Swift VM Tools
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+A set of scripts based around cloudinitd are used to easily start virtual
+machines. To download, change to your home directory and run the
+following command:
+
+-----
+$ svn co https://svn.ci.uchicago.edu/svn/vdl2/usertools/swift-vm-boot
+-----
+
+Download your Credentials
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Run the following commands to retrieve your credentials:
+-----
+$ scp yourusername at hotel.futuregrid.org:nimbus_creds.tar.gz .
+$ tar xvfz nimbus_creds.tar.gz
+-----
+When you extract your credential file, look at the file called
+hotel.conf. Near the bottom of this file will be two settings
+called vws.repository.s3id and vws.repository.s3key. Copy these
+values for the next step.
+
+Configuring Swift VM Tools
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Change directories into the swift-vm-boot directory. Edit the file
+called env.sh. There are two settings here that you will need to
+modify: FUTUREGRID_IAAS_ACCESS_KEY and FUTUREGRID_IAAS_SECRET_KEY.
+Paste your access key (s3id) and secret key (s3key) here and save
+the file. By default, env.sh requests 2 nodes on hotel and 2 nodes
+on sierra. Change these values as needed. Run install.sh from the
+swift-vm-boot directory to complete the installation of Swift VM
+Tools. The Swift VM Tools may require a fairly recent version of
+Python. If you run into problems while running the install.sh
+script, please try a more recent version of Python and associated
+libraries.
+
+Configuring coaster-service.conf
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Within your swift distribution's etc directory is a file called
+coaster-service.conf. There are many options here you can modify
+as needed, but these are the settings that will be required
+to run on futuregrid:
+
+-----
+export WORKER_WORK=/tmp
+export WORKER_MODE=futuregrid
+export SHARED_FILESYSTEM=no
+export WORKER_USERNAME=root
+export SSH_TUNNELING=yes
+export SWIFTVMBOOT_DIR=$HOME/swift-vm-boot
+export WORK=/tmp
+-----
+
+These is a brief description of these settings in the coaster-service.conf file.
+Tunneling should be used when you are restricted by a firewall. If your local
+machine has multiple network interfaces, you should also manually set the IP
+address of your machine with export IPADDR=your.ip.address.here.
+
+Starting the Coaster Service Script
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Now that everything is configured, change to a temporary directory
+and run this command to start the coaster service:
+
+-----
+$ start-coaster-service
+-----
+
+This command will start the VMs, start the required processes on the worker nodes,
+and generate Swift configuration files for you to use. The configuration files
+will be generated in your current directory. These files are sites.xml, tc.data,
+and cf.
+
+Running Swift
+~~~~~~~~~~~~~
+Now that you have all of your configuration files generated, run the following command:
+
+-----
+$ swift -sites.file sites.xml -tc.file tc.data -config cf <yourscript.swift>
+-----
+
+If you would like to create a custom tc file for repeated use, rename it to something other
+than tc.data to prevent it from being overwritten. The sites.xml however will need to be
+regenerated every time you start the coaster service. If you need to repeatedly modify some
+sites.xml options, you may edit the template in Swift's etc/sites/persistent-coasters. You
+may also create your own custom tc files with the hostname of persistent-coasters. More
+information about this can be found in the Swift userguide at
+http://www.ci.uchicago.edu/swift/guides/trunk/userguide/userguide.html.
+
+Stopping the Coaster Service Script
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+To stop the coaster service, run the following command:
+-----
+$ stop-coaster-service
+-----
+
+This will kill the coaster service, kill the worker scripts on remote systems and terminate
+the virtual machines that were created during start-coaster-service.
+
+More Help
+~~~~~~~~~
+The best place for additional help is the Swift user mailing list. You can subscribe to this list at
+http://mail.ci.uchicago.edu/mailman/listinfo/swift-user. When submitting information, please send
+your sites.xml file, your tc.data, and any error messages you run into.
+
Added: trunk/docs/siteguide/pads
===================================================================
--- trunk/docs/siteguide/pads (rev 0)
+++ trunk/docs/siteguide/pads 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,188 @@
+PADS
+----
+
+Requesting Access
+~~~~~~~~~~~~~~~~~
+If you do not already have a Computation Institute account, you can request
+one at https://www.ci.uchicago.edu/accounts/. This page will give you a list
+of resources you can request access to. Be sure that PADS is selected. If
+you already have an existing CI account, but do not have access to PADS,
+send an email to support at ci.uchicago.edu to request access.
+
+SSH Keys
+~~~~~~~~
+Before accessing PADS, be sure to have your SSH keys configured correctly.
+There is some basic information about SSH and how to generate your key at
+http://www.ci.uchicago.edu/wiki/bin/view/Resources/SshKeys. Once you have
+followed those instructions, you can add your key at
+https://www.ci.uchicago.edu/support/sshkeys/.
+
+Connecting to a login node
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Once your keys are configured, you should be able to access a PADS login
+node with the following command:
+
+-----
+ssh yourusername at login.pads.ci.uchicago.edu
+-----
+
+Configuring softenv
+~~~~~~~~~~~~~~~~~~~
+Softenv is a system used for managing applications. In order to run Swift,
+the softenv environment will have to be modified slightly. Softenv is
+configured by a file in your home directory called .soft. Edit this file
+to look like this:
+-----
++java-sun
++maui
++torque
+ at default
+-----
+
+Downloading and building Swift
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The most recent versions of Swift can be found at
+http://www.ci.uchicago.edu/swift/downloads/index.php. Follow the instructions
+provided on that site to download and build Swift.
+
+Adding Swift to your PATH
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Once you have installed Swift, add the Swift binary to your PATH so you can
+easily run it from any directory.
+
+In your home directory, edit the file ".bashrc".
+
+If you have installed Swift via a source repository, add the following line
+at the bottom of .bashrc.
+
+-----
+export PATH=$PATH:$HOME/cog/modules/swift/dist/swift-svn/bin
+-----
+
+If you have installed Swift via a binary package, add this line:
+
+-----
+export PATH=$PATH:$HOME/swift-<version>/bin
+-----
+
+Replace <version> with the actual name of the swift directory in the example above.
+
+What You Need To Know Before Running Swift
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Before you can create a Swift configuration file, there are some things
+you will need to know.
+
+Swift Work Directory
+^^^^^^^^^^^^^^^^^^^^
+The Swift work directory is a directory which Swift uses for processing work.
+This directory needs to be writable. Common options for this are:
+
+-----
+/home/username/swiftwork
+/home/username/work
+/tmp
+-----
+
+Which project(s) are you a member of?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+PADS requires that you are a member of a project. You can determine this by
+running the following command:
+
+-----
+$ projects --available
+
+The following projects are available for your use
+
+Project PI Title
+
+CI-CCR000013 Michael Wilde The Swift Parallel Scripting System
+-----
+
+If you are not a member of a project, you must first request access
+to a project at http://www.ci.uchicago.edu/hpc/projects.
+
+You should make sure that you have a project set as default. Run
+the projects command with no arguments to determine if you have a default.
+
+------
+$ projects
+You have no default project set.
+-----
+
+To set your default project, use projects --set
+------
+$ projects --set CI-CCR000013 --all
+Your default project for all CI clusters has been set to CI-CCR000013.
+-----
+
+Determine your Queue
+^^^^^^^^^^^^^^^^^^^^
+
+PADS has several different queues you can submit jobs to depending on
+the type of work you will be doing. The command "qstat -q" will print
+the most up to date list of this information.
+
+.PADS Queues
+[options="header"]
+|=========================================================
+|Queue |Memory|CPU Time|Walltime|Node|Run|Que|Lm |State
+|route |-- |-- |-- |-- | 0| 0|-- | E R
+|short |-- |-- |04:00:00|-- | 64| 0|-- | E R
+|extended|-- |-- |-- |-- | 0| 0|-- | E R
+|fast |-- |-- |01:00:00|1 | 0|152|-- | E R
+|long |-- |-- |24:00:00|-- |232|130|-- | E R
+|=========================================================
+
+Generating Configuration Files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Now that you know what queue to use, your project, and your work directory, it is time to
+set up Swift. Swift uses a configuration file called sites.xml to determine how it should run.
+There are two methods you can use for creating this file. You can manually edit
+the configuration file, or generate it with a utility called gensites.
+
+Manually Editing sites.xml
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+Below is the template that is used by Swift's test suite for running on PADS.
+
+-----
+include::../../tests/providers/local-pbs/pads/sites.template.xml[]
+-----
+
+The values to note here are the ones that are listed between underscores. In the example above, they are _QUEUE_, and _WORK_. Queue is the PADS queue to use and WORK is the swift work directory. These are placeholder values you will need to modify to fit your needs. Copy and paste this template, replace the values, and call it sites.xml.
+
+Manually Editing tc.data
+~~~~~~~~~~~~~~~~~~~~~~~~
+Below is the tc.data file used by Swift's test suite for running on PADS.
+
+-----
+include::../../tests/providers/local-pbs/pads/tc.template.data[]
+------
+
+Copy these commands and save it as tc.data.
+
+Catsn.swift
+~~~~~~~~~~~
+The swift script we will run is called catsn.swift. It simply cats a file and saves the result. This is a nice simple test to ensure jobs are running correctly. Create a file called data.txt which contains some simple input - a "hello world" will do the trick.
+
+-----
+include::../../examples/catsn.swift[]
+-----
+
+Running Swift
+~~~~~~~~~~~~~
+Now that everything is in place, run Swift with the following command:
+
+-----
+swift -sites.file sites.xml -tc.file tc.data catsn.swift -n=10
+-----
+
+You should see several new files being created, called catsn.0001.out, catsn.0002.out, etc. Each of these
+files should contain the contents of what you placed into data.txt. If this happens, your job has run
+successfully on PADS!
+
+More Help
+~~~~~~~~~
+The best place for additional help is the Swift user mailing list. You can subscribe to this list at
+https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user. When submitting information, please send your sites.xml file, your tc.data, and any Swift log files that were created during your attempt.
+
+
Added: trunk/docs/siteguide/siteguide.html
===================================================================
--- trunk/docs/siteguide/siteguide.html (rev 0)
+++ trunk/docs/siteguide/siteguide.html 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,964 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.5.2" />
+<title>Site Configuration Guide</title>
+<style type="text/css">
+/* Debug borders */
+p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
+/*
+ border: 1px solid red;
+*/
+}
+
+body {
+ margin: 1em 5% 1em 5%;
+}
+
+a {
+ color: blue;
+ text-decoration: underline;
+}
+a:visited {
+ color: fuchsia;
+}
+
+em {
+ font-style: italic;
+ color: navy;
+}
+
+strong {
+ font-weight: bold;
+ color: #083194;
+}
+
+tt {
+ color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #527bbd;
+ font-family: sans-serif;
+ margin-top: 1.2em;
+ margin-bottom: 0.5em;
+ line-height: 1.3;
+}
+
+h1, h2, h3 {
+ border-bottom: 2px solid silver;
+}
+h2 {
+ padding-top: 0.5em;
+}
+h3 {
+ float: left;
+}
+h3 + * {
+ clear: left;
+}
+
+div.sectionbody {
+ font-family: serif;
+ margin-left: 0;
+}
+
+hr {
+ border: 1px solid silver;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+ margin-top: 0;
+}
+
+pre {
+ padding: 0;
+ margin: 0;
+}
+
+span#author {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+ font-family: sans-serif;
+}
+
+div#footer {
+ font-family: sans-serif;
+ font-size: small;
+ border-top: 2px solid silver;
+ padding-top: 0.5em;
+ margin-top: 4.0em;
+}
+div#footer-text {
+ float: left;
+ padding-bottom: 0.5em;
+}
+div#footer-badges {
+ float: right;
+ padding-bottom: 0.5em;
+}
+
+div#preamble {
+ margin-top: 1.5em;
+ margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+ margin-top: 1.0em;
+ margin-bottom: 1.5em;
+}
+div.admonitionblock {
+ margin-top: 2.0em;
+ margin-bottom: 2.0em;
+ margin-right: 10%;
+ color: #606060;
+}
+
+div.content { /* Block element content. */
+ padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ text-align: left;
+ margin-top: 1.0em;
+ margin-bottom: 0.5em;
+}
+div.title + * {
+ margin-top: 0;
+}
+
+td div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content + div.title {
+ margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+
+div.listingblock > div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+ padding-left: 1.0em;
+ margin-left: 1.0em;
+ margin-right: 10%;
+ border-left: 5px solid #dddddd;
+ color: #777777;
+}
+
+div.quoteblock > div.attribution {
+ padding-top: 0.5em;
+ text-align: right;
+}
+
+div.verseblock > div.content {
+ white-space: pre;
+}
+div.verseblock > div.attribution {
+ padding-top: 0.75em;
+ text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+ text-align: left;
+}
+
+div.admonitionblock .icon {
+ vertical-align: top;
+ font-size: 1.1em;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #527bbd;
+ padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+ padding-left: 0.5em;
+ border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+ border-left: 3px solid #dddddd;
+ padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+dt {
+ margin-top: 0.5em;
+ margin-bottom: 0;
+ font-style: normal;
+ color: navy;
+}
+dd > *:first-child {
+ margin-top: 0.1em;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+ol.arabic {
+ list-style-type: decimal;
+}
+ol.loweralpha {
+ list-style-type: lower-alpha;
+}
+ol.upperalpha {
+ list-style-type: upper-alpha;
+}
+ol.lowerroman {
+ list-style-type: lower-roman;
+}
+ol.upperroman {
+ list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+ margin-top: 0.1em;
+ margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+ border: 3px solid #527bbd;
+}
+thead, p.table.header {
+ font-family: sans-serif;
+ font-weight: bold;
+}
+tfoot {
+ font-weight: bold;
+}
+td > div.verse {
+ white-space: pre;
+}
+p.table {
+ margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+ border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+ border-left-style: none;
+ border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+ border-top-style: none;
+ border-bottom-style: none;
+}
+
+
+div.hdlist {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+div.hdlist tr {
+ padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+ font-weight: bold;
+}
+td.hdlist1 {
+ vertical-align: top;
+ font-style: normal;
+ padding-right: 0.8em;
+ color: navy;
+}
+td.hdlist2 {
+ vertical-align: top;
+}
+div.hdlist.compact tr {
+ margin: 0;
+ padding-bottom: 0;
+}
+
+.comment {
+ background: yellow;
+}
+
+.footnote, .footnoteref {
+ font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+ vertical-align: super;
+}
+
+#footnotes {
+ margin: 20px 0 20px 0;
+ padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+ margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+ border: none;
+ border-top: 1px solid silver;
+ height: 1px;
+ text-align: left;
+ margin-left: 0;
+ width: 20%;
+ min-width: 100px;
+}
+
+
+ at media print {
+ div#footer-badges { display: none; }
+}
+
+div#toc {
+ margin-bottom: 2.5em;
+}
+
+div#toctitle {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 1.0em;
+ margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+div.toclevel2 {
+ margin-left: 2em;
+ font-size: 0.9em;
+}
+div.toclevel3 {
+ margin-left: 4em;
+ font-size: 0.9em;
+}
+div.toclevel4 {
+ margin-left: 6em;
+ font-size: 0.9em;
+}
+/* Workarounds for IE6's broken and incomplete CSS2. */
+
+div.sidebar-content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+div.sidebar-title, div.image-title {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ margin-top: 0.0em;
+ margin-bottom: 0.5em;
+}
+
+div.listingblock div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock-attribution {
+ padding-top: 0.5em;
+ text-align: right;
+}
+
+div.verseblock-content {
+ white-space: pre;
+}
+div.verseblock-attribution {
+ padding-top: 0.75em;
+ text-align: left;
+}
+
+div.exampleblock-content {
+ border-left: 3px solid #dddddd;
+ padding-left: 0.5em;
+}
+
+/* IE6 sets dynamically generated links as visited. */
+div#toc a:visited { color: blue; }
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}
+var asciidoc = { // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+ function getText(el) {
+ var text = "";
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+ text += i.data;
+ else if (i.firstChild != null)
+ text += getText(i);
+ }
+ return text;
+ }
+
+ function TocEntry(el, text, toclevel) {
+ this.element = el;
+ this.text = text;
+ this.toclevel = toclevel;
+ }
+
+ function tocEntries(el, toclevels) {
+ var result = new Array;
+ var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ // Function that scans the DOM tree for header elements (the DOM2
+ // nodeIterator API would be a better technique but not supported by all
+ // browsers).
+ var iterate = function (el) {
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+ var mo = re.exec(i.tagName);
+ if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+ result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+ }
+ iterate(i);
+ }
+ }
+ }
+ iterate(el);
+ return result;
+ }
+
+ var toc = document.getElementById("toc");
+ var entries = tocEntries(document.getElementById("content"), toclevels);
+ for (var i = 0; i < entries.length; ++i) {
+ var entry = entries[i];
+ if (entry.element.id == "")
+ entry.element.id = "_toc_" + i;
+ var a = document.createElement("a");
+ a.href = "#" + entry.element.id;
+ a.appendChild(document.createTextNode(entry.text));
+ var div = document.createElement("div");
+ div.appendChild(a);
+ div.className = "toclevel" + entry.toclevel;
+ toc.appendChild(div);
+ }
+ if (entries.length == 0)
+ toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+ var cont = document.getElementById("content");
+ var noteholder = document.getElementById("footnotes");
+ var spans = cont.getElementsByTagName("span");
+ var refs = {};
+ var n = 0;
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnote") {
+ n++;
+ // Use [\s\S] in place of . so multi-line matches work.
+ // Because JavaScript has no s (dotall) regex flag.
+ note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+ noteholder.innerHTML +=
+ "<div class='footnote' id='_footnote_" + n + "'>" +
+ "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+ n + "</a>. " + note + "</div>";
+ spans[i].innerHTML =
+ "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ var id =spans[i].getAttribute("id");
+ if (id != null) refs["#"+id] = n;
+ }
+ }
+ if (n == 0)
+ noteholder.parentNode.removeChild(noteholder);
+ else {
+ // Process footnoterefs.
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnoteref") {
+ var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+ href = href.match(/#.*/)[0]; // Because IE return full URL.
+ n = refs[href];
+ spans[i].innerHTML =
+ "[<a href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ }
+ }
+ }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body style="max-width:750px">
+<div id="header">
+<h1>Site Configuration Guide</h1>
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+</div>
+<div id="content">
+<h2 id="_pads">1. PADS</h2>
+<div class="sectionbody">
+<h3 id="_requesting_access">1.1. Requesting Access</h3><div style="clear:left"></div>
+<div class="paragraph"><p>If you do not already have a Computation Institute account, you can request
+one at <a href="https://www.ci.uchicago.edu/accounts/">https://www.ci.uchicago.edu/accounts/</a>. This page will give you a list
+of resources you can request access to. Be sure that PADS is selected. If
+you already have an existing CI account, but do not have access to PADS,
+send an email to <a href="mailto:support at ci.uchicago.edu">support at ci.uchicago.edu</a> to request access.</p></div>
+<h3 id="_ssh_keys">1.2. SSH Keys</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Before accessing PADS, be sure to have your SSH keys configured correctly.
+There is some basic information about SSH and how to generate your key at
+<a href="http://www.ci.uchicago.edu/wiki/bin/view/Resources/SshKeys">http://www.ci.uchicago.edu/wiki/bin/view/Resources/SshKeys</a>. Once you have
+followed those instructions, you can add your key at
+<a href="https://www.ci.uchicago.edu/support/sshkeys/">https://www.ci.uchicago.edu/support/sshkeys/</a>.</p></div>
+<h3 id="_connecting_to_a_login_node">1.3. Connecting to a login node</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Once your keys are configured, you should be able to access a PADS login
+node with the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>ssh yourusername at login.pads.ci.uchicago.edu</tt></pre>
+</div></div>
+<h3 id="_configuring_softenv">1.4. Configuring softenv</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Softenv is a system used for managing applications. In order to run Swift,
+the softenv environment will have to be modified slightly. Softenv is
+configured by a file in your home directory called .soft. Edit this file
+to look like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>+java-sun
++maui
++torque
+ at default</tt></pre>
+</div></div>
+<h3 id="_downloading_and_building_swift">1.5. Downloading and building Swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>The most recent versions of Swift can be found at
+<a href="http://www.ci.uchicago.edu/swift/downloads/index.php">http://www.ci.uchicago.edu/swift/downloads/index.php</a>. Follow the instructions
+provided on that site to download and build Swift.</p></div>
+<h3 id="_adding_swift_to_your_path">1.6. Adding Swift to your PATH</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Once you have installed Swift, add the Swift binary to your PATH so you can
+easily run it from any directory.</p></div>
+<div class="paragraph"><p>In your home directory, edit the file ".bashrc".</p></div>
+<div class="paragraph"><p>If you have installed Swift via a source repository, add the following line
+at the bottom of .bashrc.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>export PATH=$PATH:$HOME/cog/modules/swift/dist/swift-svn/bin</tt></pre>
+</div></div>
+<div class="paragraph"><p>If you have installed Swift via a binary package, add this line:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>export PATH=$PATH:$HOME/swift-<version>/bin</tt></pre>
+</div></div>
+<div class="paragraph"><p>Replace <version> with the actual name of the swift directory in the example above.</p></div>
+<h3 id="_what_you_need_to_know_before_running_swift">1.7. What You Need To Know Before Running Swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Before you can create a Swift configuration file, there are some things
+you will need to know.</p></div>
+<h4 id="_swift_work_directory">1.7.1. Swift Work Directory</h4>
+<div class="paragraph"><p>The Swift work directory is a directory which Swift uses for processing work.
+This directory needs to be writable. Common options for this are:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>/home/username/swiftwork
+/home/username/work
+/tmp</tt></pre>
+</div></div>
+<h4 id="_which_project_s_are_you_a_member_of">1.7.2. Which project(s) are you a member of?</h4>
+<div class="paragraph"><p>PADS requires that you are a member of a project. You can determine this by
+running the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ projects --available
+
+The following projects are available for your use
+
+Project PI Title
+
+CI-CCR000013 Michael Wilde The Swift Parallel Scripting System</tt></pre>
+</div></div>
+<div class="paragraph"><p>If you are not a member of a project, you must first request access
+to a project at <a href="http://www.ci.uchicago.edu/hpc/projects">http://www.ci.uchicago.edu/hpc/projects</a>.</p></div>
+<div class="paragraph"><p>You should make sure that you have a project set as default. Run
+the projects command with no arguments to determine if you have a default.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ projects
+You have no default project set.</tt></pre>
+</div></div>
+<div class="paragraph"><p>To set your default project, use projects --set</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ projects --set CI-CCR000013 --all
+Your default project for all CI clusters has been set to CI-CCR000013.</tt></pre>
+</div></div>
+<h4 id="_determine_your_queue">1.7.3. Determine your Queue</h4>
+<div class="paragraph"><p>PADS has several different queues you can submit jobs to depending on
+the type of work you will be doing. The command "qstat -q" will print
+the most up to date list of this information.</p></div>
+<div class="tableblock">
+<table rules="all"
+width="100%"
+frame="border"
+cellspacing="0" cellpadding="4">
+<caption class="title">Table 1. PADS Queues</caption>
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<col width="11%" />
+<thead>
+<tr>
+<th align="left" valign="top">Queue </th>
+<th align="left" valign="top">Memory</th>
+<th align="left" valign="top">CPU Time</th>
+<th align="left" valign="top">Walltime</th>
+<th align="left" valign="top">Node</th>
+<th align="left" valign="top">Run</th>
+<th align="left" valign="top">Que</th>
+<th align="left" valign="top">Lm </th>
+<th align="left" valign="top">State</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td align="left" valign="top"><p class="table">route</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">E R</p></td>
+</tr>
+<tr>
+<td align="left" valign="top"><p class="table">short</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">04:00:00</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">64</p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">E R</p></td>
+</tr>
+<tr>
+<td align="left" valign="top"><p class="table">extended</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">E R</p></td>
+</tr>
+<tr>
+<td align="left" valign="top"><p class="table">fast</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">01:00:00</p></td>
+<td align="left" valign="top"><p class="table">1</p></td>
+<td align="left" valign="top"><p class="table">0</p></td>
+<td align="left" valign="top"><p class="table">152</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">E R</p></td>
+</tr>
+<tr>
+<td align="left" valign="top"><p class="table">long</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">24:00:00</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">232</p></td>
+<td align="left" valign="top"><p class="table">130</p></td>
+<td align="left" valign="top"><p class="table">— </p></td>
+<td align="left" valign="top"><p class="table">E R</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<h3 id="_generating_configuration_files">1.8. Generating Configuration Files</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now that you know what queue to use, your project, and your work directory, it is time to
+set up Swift. Swift uses a configuration file called sites.xml to determine how it should run.
+There are two methods you can use for creating this file. You can manually edit
+the configuration file, or generate it with a utility called gensites.</p></div>
+<h4 id="_manually_editing_sites_xml">1.8.1. Manually Editing sites.xml</h4>
+<div class="paragraph"><p>Below is the template that is used by Swift’s test suite for running on PADS.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt><config>
+<pool handle="pads-pbs">
+ <execution jobmanager="local:pbs" provider="local" url="none" />
+ <filesystem provider="local" url="none" />
+ <profile key="jobThrottle" namespace="karajan">0</profile>
+ <profile namespace="globus" key="project">_QUEUE_</profile>
+ <workdirectory>_WORK_</workdirectory>
+</pool>
+</config></tt></pre>
+</div></div>
+<div class="paragraph"><p>The values to note here are the ones that are listed between underscores. In the example above, they are <em>QUEUE</em>, and <em>WORK</em>. Queue is the PADS queue to use and WORK is the swift work directory. These are placeholder values you will need to modify to fit your needs. Copy and paste this template, replace the values, and call it sites.xml.</p></div>
+<h3 id="_manually_editing_tc_data">1.9. Manually Editing tc.data</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Below is the tc.data file used by Swift’s test suite for running on PADS.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>pads-pbs echo /bin/echo INSTALLED INTEL32::LINUX
+pads-pbs cat /bin/cat INSTALLED INTEL32::LINUX
+pads-pbs ls /bin/ls INSTALLED INTEL32::LINUX
+pads-pbs grep /bin/grep INSTALLED INTEL32::LINUX
+pads-pbs sort /bin/sort INSTALLED INTEL32::LINUX
+pads-pbs paste /bin/paste INSTALLED INTEL32::LINUX
+pads-pbs wc /usr/bin/wc INSTALLED INTEL32::LINUX</tt></pre>
+</div></div>
+<div class="paragraph"><p>Copy these commands and save it as tc.data.</p></div>
+<h3 id="_catsn_swift">1.10. Catsn.swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>The swift script we will run is called catsn.swift. It simply cats a file and saves the result. This is a nice simple test to ensure jobs are running correctly. Create a file called data.txt which contains some simple input - a "hello world" will do the trick.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type file;
+
+app (file o) cat (file i)
+{
+ cat @i stdout=@o;
+}
+
+string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+string char[] = @strsplit(t, "");
+
+file out[]<simple_mapper; location=".", prefix="catsn.",suffix=".out">;
+foreach j in [1:@toint(@arg("n","10"))] {
+ file data<"data.txt">;
+ out[j] = cat(data);
+}</tt></pre>
+</div></div>
+<h3 id="_running_swift">1.11. Running Swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now that everything is in place, run Swift with the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>swift -sites.file sites.xml -tc.file tc.data catsn.swift -n=10</tt></pre>
+</div></div>
+<div class="paragraph"><p>You should see several new files being created, called catsn.0001.out, catsn.0002.out, etc. Each of these
+files should contain the contents of what you placed into data.txt. If this happens, your job has run
+successfully on PADS!</p></div>
+<h3 id="_more_help">1.12. More Help</h3><div style="clear:left"></div>
+<div class="paragraph"><p>The best place for additional help is the Swift user mailing list. You can subscribe to this list at
+<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user</a>. When submitting information, please send your sites.xml file, your tc.data, and any Swift log files that were created during your attempt.</p></div>
+</div>
+<h2 id="_beagle">2. Beagle</h2>
+<div class="sectionbody">
+<h3 id="_requesting_access_2">2.1. Requesting Access</h3><div style="clear:left"></div>
+<div class="paragraph"><p>If you do not already have a Computation Institute account, you can request
+one at <a href="https://www.ci.uchicago.edu/accounts/">https://www.ci.uchicago.edu/accounts/</a>. This page will give you a list
+of resources you can request access to.
+You already have an existing CI account, but do not have access to Beagle,
+send an email to <a href="mailto:support at ci.uchicago.edu">support at ci.uchicago.edu</a> to request access.</p></div>
+<h3 id="_connecting_to_a_login_node_2">2.2. Connecting to a login node</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Once you have account, you should be able to access a Beagle login
+node with the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>ssh yourusername at login.beagle.ci.uchicago.edu</tt></pre>
+</div></div>
+<div class="paragraph"><p>Follow the steps outlined below to get started with Swift on Beagle:</p></div>
+<div class="paragraph"><p><strong>step 1.</strong> Load the Swift module on Beagle as follows: <tt>module load swift</tt></p></div>
+<div class="paragraph"><p><strong>step 2.</strong> Create and change to a directory where your Swift related work will
+stay. (say, <tt>mkdir swift-lab</tt>, followed by, <tt>cd swift-lab</tt>)</p></div>
+<div class="paragraph"><p><strong>step 3.</strong> To get started with a simple example running <tt>/bin/cat</tt> to read an
+input file <tt>data.txt</tt> and write to an output file <tt>f.nnn.out</tt>, copy the folder
+at <tt>/home/ketan/catsn</tt> to the above directory. (<tt>cp -r /home/ketan/catsn
+.</tt> followed by <tt>cd catsn</tt>).</p></div>
+<div class="paragraph"><p><strong>step 4.</strong> In the sites file: <tt>beagle-coaster.xml</tt>, make the following two
+changes: <strong>1)</strong> change the path of <tt>workdirectory</tt> to your preferred location
+(say to <tt>/lustre/beagle/$USER/swift-lab/swift.workdir</tt>) and <strong>2)</strong> Change the
+project name to your project (<tt>CI-CCR000013</tt>) . The workdirectory will contain
+execution data related to each run, e.g. wrapper scripts, system information,
+inputs and outputs.</p></div>
+<div class="paragraph"><p><strong>step 5.</strong> Run the example using following commandline (also found in run.sh):
+<tt>swift -config cf -tc.file tc -sites.file beagle-coaster.xml catsn.swift -n=1</tt>
+. You can further change the value of <tt>-n</tt> to any arbitrary number to run that
+many number of concurrent <tt>cat</tt></p></div>
+<div class="paragraph"><p><strong>step 6.</strong> Check the output in the generated <tt>outdir</tt> directory (<tt>ls outdir</tt>)</p></div>
+<div class="paragraph"><p>Note: Running from sandbox node or requesting 1 hour walltime for upto 3 nodes
+will get fast prioritized execution. Good for small tests.</p></div>
+</div>
+<h2 id="_futuregrid_quickstart_guide">3. Futuregrid Quickstart Guide</h2>
+<div class="sectionbody">
+<h3 id="_downloading_and_building_swift_2">3.1. Downloading and Building Swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>The most recent versions of Swift can be found at
+<a href="http://www.ci.uchicago.edu/swift/downloads/index.php">http://www.ci.uchicago.edu/swift/downloads/index.php</a>. To run on futuregrid,
+you will need to download the development/trunk version from SVN.</p></div>
+<h3 id="_adding_swift_to_your_path_2">3.2. Adding Swift to your PATH</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Once you have installed Swift, add the Swift binary to your PATH so you can
+easily run it from any directory.</p></div>
+<div class="paragraph"><p>In your home directory, edit the file ".bashrc".</p></div>
+<div class="paragraph"><p>If you have installed Swift via a source repository, add the following line
+at the bottom of .bashrc.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>export PATH=$PATH:$HOME/cog/modules/swift/dist/swift-svn/bin</tt></pre>
+</div></div>
+<h3 id="_requesting_futuregrid_access">3.3. Requesting Futuregrid Access</h3><div style="clear:left"></div>
+<div class="paragraph"><p>If you do not already have a futuregrid account, you can follow the
+instructions at <a href="https://portal.futuregrid.org/gettingstarted">https://portal.futuregrid.org/gettingstarted</a> to get started.
+This page provides information on how to create an account, how to join
+a project, how to set up your SSH keys, and how to create a new project.</p></div>
+<h3 id="_downloading_swift_vm_tools">3.4. Downloading Swift VM Tools</h3><div style="clear:left"></div>
+<div class="paragraph"><p>A set of scripts based around cloudinitd are used to easily start virtual
+machines. To download, change to your home directory and run the
+following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ svn co https://svn.ci.uchicago.edu/svn/vdl2/usertools/swift-vm-boot</tt></pre>
+</div></div>
+<h3 id="_download_your_credentials">3.5. Download your Credentials</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Run the following commands to retrieve your credentials:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ scp yourusername at hotel.futuregrid.org:nimbus_creds.tar.gz .
+$ tar xvfz nimbus_creds.tar.gz</tt></pre>
+</div></div>
+<div class="paragraph"><p>When you extract your credential file, look at the file called
+hotel.conf. Near the bottom of this file will be two settings
+called vws.repository.s3id and vws.repository.s3key. Copy these
+values for the next step.</p></div>
+<h3 id="_configuring_swift_vm_tools">3.6. Configuring Swift VM Tools</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Change directories into the swift-vm-boot directory. Edit the file
+called env.sh. There are two settings here that you will need to
+modify: FUTUREGRID_IAAS_ACCESS_KEY and FUTUREGRID_IAAS_SECRET_KEY.
+Paste your access key (s3id) and secret key (s3key) here and save
+the file. By default, env.sh requests 2 nodes on hotel and 2 nodes
+on sierra. Change these values as needed. Run install.sh from the
+swift-vm-boot directory to complete the installation of Swift VM
+Tools. The Swift VM Tools may require a fairly recent version of
+Python. If you run into problems while running the install.sh
+script, please try a more recent version of Python and associated
+libraries.</p></div>
+<h3 id="_configuring_coaster_service_conf">3.7. Configuring coaster-service.conf</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Within your swift distribution’s etc directory is a file called
+coaster-service.conf. There are many options here you can modify
+as needed, but these are the settings that will be required
+to run on futuregrid:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>export WORKER_WORK=/tmp
+export WORKER_MODE=futuregrid
+export SHARED_FILESYSTEM=no
+export WORKER_USERNAME=root
+export SSH_TUNNELING=yes
+export SWIFTVMBOOT_DIR=$HOME/swift-vm-boot
+export WORK=/tmp</tt></pre>
+</div></div>
+<div class="paragraph"><p>These is a brief description of these settings in the coaster-service.conf file.
+Tunneling should be used when you are restricted by a firewall. If your local
+machine has multiple network interfaces, you should also manually set the IP
+address of your machine with export IPADDR=your.ip.address.here.</p></div>
+<h3 id="_starting_the_coaster_service_script">3.8. Starting the Coaster Service Script</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now that everything is configured, change to a temporary directory
+and run this command to start the coaster service:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ start-coaster-service</tt></pre>
+</div></div>
+<div class="paragraph"><p>This command will start the VMs, start the required processes on the worker nodes,
+and generate Swift configuration files for you to use. The configuration files
+will be generated in your current directory. These files are sites.xml, tc.data,
+and cf.</p></div>
+<h3 id="_running_swift_2">3.9. Running Swift</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now that you have all of your configuration files generated, run the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift -sites.file sites.xml -tc.file tc.data -config cf <yourscript.swift></tt></pre>
+</div></div>
+<div class="paragraph"><p>If you would like to create a custom tc file for repeated use, rename it to something other
+than tc.data to prevent it from being overwritten. The sites.xml however will need to be
+regenerated every time you start the coaster service. If you need to repeatedly modify some
+sites.xml options, you may edit the template in Swift’s etc/sites/persistent-coasters. You
+may also create your own custom tc files with the hostname of persistent-coasters. More
+information about this can be found in the Swift userguide at
+<a href="http://www.ci.uchicago.edu/swift/guides/trunk/userguide/userguide.html">http://www.ci.uchicago.edu/swift/guides/trunk/userguide/userguide.html</a>.</p></div>
+<h3 id="_stopping_the_coaster_service_script">3.10. Stopping the Coaster Service Script</h3><div style="clear:left"></div>
+<div class="paragraph"><p>To stop the coaster service, run the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ stop-coaster-service</tt></pre>
+</div></div>
+<div class="paragraph"><p>This will kill the coaster service, kill the worker scripts on remote systems and terminate
+the virtual machines that were created during start-coaster-service.</p></div>
+<h3 id="_more_help_2">3.11. More Help</h3><div style="clear:left"></div>
+<div class="paragraph"><p>The best place for additional help is the Swift user mailing list. You can subscribe to this list at
+<a href="http://mail.ci.uchicago.edu/mailman/listinfo/swift-user">http://mail.ci.uchicago.edu/mailman/listinfo/swift-user</a>. When submitting information, please send
+your sites.xml file, your tc.data, and any error messages you run into.</p></div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2011-07-13 00:42:08 CDT
+</div>
+</div>
+</body>
+</html>
Added: trunk/docs/siteguide/siteguide.txt
===================================================================
--- trunk/docs/siteguide/siteguide.txt (rev 0)
+++ trunk/docs/siteguide/siteguide.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,13 @@
+Site Configuration Guide
+========================
+
+:toc:
+:icons:
+:website: http://www.ci.uchicago.edu/swift/guides/siteguide.php
+:numbered:
+
+include::pads[]
+
+include::beagle[]
+
+include::futuregrid[]
Deleted: trunk/docs/tutorial/abstract
===================================================================
--- trunk/docs/tutorial/abstract 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/abstract 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,7 +0,0 @@
-[abstract]
-Abstract
---------
-This is an introductory tutorial on the use of Swift and its programming
-language SwiftScript.
-
-note: merge with intro?
Added: trunk/docs/tutorial/abstract
===================================================================
--- trunk/docs/tutorial/abstract (rev 0)
+++ trunk/docs/tutorial/abstract 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,7 @@
+[abstract]
+Abstract
+--------
+This is an introductory tutorial on the use of Swift and its programming
+language SwiftScript.
+
+note: merge with intro?
Deleted: trunk/docs/tutorial/bits
===================================================================
--- trunk/docs/tutorial/bits 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/bits 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,32 +0,0 @@
-bits
-----
-
-Named and optional parameters
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In addition to specifying parameters positionally, parameters can be
-named, and if desired a default value can be specified:
-
-
-----
-(messagefile t) greeting (string s="hello") {
- app {
- echo s stdout=@filename(t);
- }
-}
-----
-
-When we invoke the procedure, we can specify values for the parameters
-by name. The following code can be found in q21.swift.
-
-
-----
-french = greeting(s="bonjour");
-----
-
-or we can let the default value apply:
-
-
-----
-english = greeting();
-----
Added: trunk/docs/tutorial/bits
===================================================================
--- trunk/docs/tutorial/bits (rev 0)
+++ trunk/docs/tutorial/bits 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,15 @@
+Bits
+----
+
+Named and optional parameters
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In addition to specifying parameters positionally, parameters can be
+named, and if desired a default value can be specified:
+
+.default.swift
+**************
+----
+include::../../examples/tutorial/default.swift[]
+----
+**************
Deleted: trunk/docs/tutorial/hello_world
===================================================================
--- trunk/docs/tutorial/hello_world 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/hello_world 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,72 +0,0 @@
-Hello World
------------
-The first example program, first.swift, outputs a hello world message
-into a file called hello.txt.
-
-.first.swift
-************
-
-----
-include::../../examples/first.swift[]
-----
-************
-
-We can run this program as follows:
-note: Make sure the bin directory of swift-installation is in your path.
-----
-$ cd examples/swift/
-$ swift first.swift
-Swift svn swift-r3334 (swift modified locally) cog-r2752
-
-RunID: 20100526-1925-8zjupq1b
-Progress:
-Final status: Finished successfully:1
-$ cat hello.txt
-Hello, world!
-----
-
-The basic structure of this program is a type definition, an
-application procedure definition, a variable definition and then a
-call to the procedure:
-
-
-----
-type messagefile;
-----
-
-First we define a new type, called messagefile. In this example, we will
-use this messagefile type as the type for our output message.
-
-
-All data in SwiftScript must be typed, whether it is stored in memory or
-on disk. This example defines a very simple type. Later on we will see
-more complex type examples.
-
-
-----
-app (messagefile t) greeting() {
- echo "Hello, world!" stdout=@filename(t);
-}
-----
-
-Next we define a procedure called greeting. This procedure will write
-out the "hello world" message to a file.
-
-To achieve this, it executes the unix utility 'echo' with a parameter
-"Hello, world!" and directs the standard output into the output file.
-
-The actual file to use is specified by the return parameter, t.
-
-messagefile outfile <"hello.txt">;
-
-Here we define a variable called outfile. The type of this variable is
-messagefile, and we specify that the contents of this variable will be
-stored on disk in a file called hello.txt
-
-outfile = greeting();
-
-Now we call the greeting procedure, with its output going to the outfile
-variable and therefore to hello.txt on disk.
-
-Over the following exercises, we'll extend this simple hello world
-program to demonstrate various features of Swift.
Added: trunk/docs/tutorial/hello_world
===================================================================
--- trunk/docs/tutorial/hello_world (rev 0)
+++ trunk/docs/tutorial/hello_world 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,69 @@
+Hello World
+-----------
+The first example program, hello.swift, outputs a hello world message
+into a file called hello.txt.
+
+.hello.swift
+************
+
+----
+include::../../examples/tutorial/hello.swift[]
+----
+************
+
+To run hello.swift, change directories to the location of the script
+and run the swift command as follows.
+
+TIP: Make sure the bin directory of your swift installation is in your PATH.
+----
+$ cd examples/tutorial
+$ swift hello.swift
+Swift svn swift-r3334 (swift modified locally) cog-r2752
+
+RunID: 20100526-1925-8zjupq1b
+Progress:
+Final status: Finished successfully:1
+$ cat hello.txt
+Hello, world!
+----
+
+The basic structure of this program is a type definition, an
+application procedure definition, a variable definition and then a
+call to the procedure.
+
+First we define a new type, called messagefile. In this example, we will
+use this messagefile type for our output message.
+
+----
+sys::[sed -n '1p' ../../examples/tutorial/hello.swift]
+----
+
+All data in SwiftScript must be typed, whether it is stored in memory or
+on disk. This example defines a very simple type. Later on we will see
+more complex type examples.
+
+----
+sys::[sed -n '3,5p' ../../examples/tutorial/hello.swift]
+----
+
+Next we define a procedure called greeting. This procedure will write
+out the "hello world" message to a file. To achieve this, it executes
+the unix utility 'echo' with a parameter "Hello, world!" and directs
+the standard output into the output file.
+
+The actual file to use is specified by the return parameter, t.
+-----
+sys::[sed -n '7p' ../../examples/tutorial/hello.swift]
+-----
+Here we define a variable called outfile. The type of this variable is
+messagefile, and we specify that the contents of this variable will be
+stored on disk in a file called hello.txt
+
+-----
+sys::[sed -n '3,5p' ../../examples/tutorial/hello.swift]
+-----
+Now we call the greeting procedure, with its output going to the outfile
+variable and therefore to hello.txt on disk.
+
+Over the following exercises, we'll extend this simple hello world
+program to demonstrate various features of Swift.
Deleted: trunk/docs/tutorial/introduction
===================================================================
--- trunk/docs/tutorial/introduction 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/introduction 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-Introduction
-------------
-This is an introductory tutorial describing the use of Swift and its programming
-language SwiftScript. It is intended to introduce new users to the basics of Swift.
-It is structured as a series of simple exercises/examples which you can
-try for yourself as you read along. After the first 'hello world'
-example, there are two tracks - the language track (which introduces the SwiftScript language) and the runtime track (which introduces features of the Swift runtime environment, such as running
-jobs on different computational 'sites').
-
-For information on getting an installation of Swift running, consult the
-Swift Quickstart Guide <http://www.ci.uchicago.edu/swift/guides/quickstartguide.php>. We advise you to install the latest stable release of Swift.
-Return to this document when you have successfully run the test SwiftScript program mentioned there.
-
-There is also a Swift User's Guide
-<http://www.ci.uchicago.edu/swift/guides/userguide.php> which contains
-a more detailed reference material on topics covered in this manual. All
-of the programs included in this tutorial can be found in your Swift
-distribution in the +examples/swift+ directory.
Added: trunk/docs/tutorial/introduction
===================================================================
--- trunk/docs/tutorial/introduction (rev 0)
+++ trunk/docs/tutorial/introduction 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+Introduction
+------------
+This is an introductory tutorial describing the use of Swift and its programming
+language SwiftScript. It is intended to introduce new users to the basics of Swift.
+It is structured as a series of simple exercises/examples which you can
+try for yourself as you read along.
+
+For information on getting an installation of Swift running, consult the
+http://www.ci.uchicago.edu/swift/guides/quickstartguide.php[Swift Quickstart Guide]. We advise you to install the latest stable release of Swift.
+Return to this document when you have successfully run the test SwiftScript program mentioned there.
+
+There is also a
+sys::[../print_link.sh userguide]
+which contains a more detailed reference material on topics covered in this manual. All
+of the programs included in this tutorial can be found in your Swift
+distribution in the examples/tutorial directory.
Deleted: trunk/docs/tutorial/language_features
===================================================================
--- trunk/docs/tutorial/language_features 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/language_features 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,403 +0,0 @@
-Language features
------------------
-
-Parameters
-~~~~~~~~~~
-
-Procedures can have parameters. Input parameters specify inputs to the
-procedure and output parameters specify outputs. Our helloworld greeting
-procedure already uses an output parameter, t, which indicates where the
-greeting output will go. In this section, we will add an input parameter
-to the greeting function.
-
-The code changes from first.swift are highlighted below.
-ToDo: Highlight the differences!
-
-----
-include::../../examples/parameter.swift[]
-----
-
-We have modified the signature of the greeting procedure to indicate
-that it takes a single parameter, s, of type 'string'.
-
-We have modified the invocation of the 'echo' utility so that it takes
-the value of s as a parameter, instead of the string literal "Hello,
-world!".
-
-We have modified the output file definition to point to a different file
-on disk.
-
-We have modified the invocation of greeting so that a greeting string is
-supplied.
-
-The code for this section can be found in parameter.swift. It can be
-invoked using the swift command, with output appearing in hello2.txt:
-
-
-----
-$ swift parameter.swift
-----
-
-Now that we can choose our greeting text, we can call the same procedure
-with different parameters to generate several output files with
-different greetings. The code is in manyparam.swift and can be run as
-before using the swift command.
-
-
-----
-include::../../examples/manyparam.swift[]
-----
-
-Note that we can intermingle definitions of variables with invocations
-of procedures.
-
-When this program has been run, there should be three new files in the
-working directory (english.txt, francais.txt and nihongo.txt) each
-containing a greeting in a different language.
-
-In addition to specifying parameters positionally, parameters can be
-named, and if desired a default value can be specified - see <<named_parameters, Named and Optional Parameters>>.
-ToDo: link not working.
-
-Adding another application
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-Now we'll define a new application procedure. The procedure we define
-will capitalise all the words in the input file.
-
-To do this, we'll use the unix tr (translate) utility. Here is an
-example of using tr on the unix command line, not using Swift:
-
-
-----
-$ echo hello | tr '[a-z]' '[A-Z]'
-HELLO
-----
-
-.There are several steps
-- Updating the transformation catalog
-- Updating the application block
-
-ToDo: What is transformation catalog? One line explanation.
-
-First we need to modify the transformation catalog to define a logical
-transformation for the tr utility. A transformation catalog lists where executables are located on computational sites.
-The transformation catalog can be found in etc/tc.data. There are already several entries specifying
-where executables can be found. Add a new line to the file, specifying
-where *tr* can be found (usually in /usr/bin/tr but it may differ on
-your system), like this:
-
-
-----
-localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null
-----
-
-For now, ignore all of the fields except the second and the third. The
-second field tr specifies a logical application name and the third
-specifies the location of the application executable.
-
-Now that we have defined where to find tr, we can use it in SwiftScript.
-
-We can define a new procedure, capitalise, which calls tr.
-
-
-----
-(messagefile o) capitalise(messagefile i) {
- app {
- tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
- }
-}
-----
-We can call capitalise like this:
-
-
-----
-messagefile final <"capitals.txt">;
-final = capitalise(hellofile);
-----
-
-So a full program based on the first exercise might look like this:
-
-
-----
-include::../../examples/second_procedure.swift[]
-----
-
-We can use the swift command to run it like this.
-
-
-----
-$ swift second_procedure.swift
-...
-$ cat capitals.txt
-HELLO FROM SWIFT
-----
-
-Anonymous files
-~~~~~~~~~~~~~~~
-In the previous section, the file greeting.txt is used only to store
-an intermediate result. We don't really care about which name is used
-for the file, and we can let Swift choose the name.
-
-To do that, omit the mapping entirely when declaring outfile:
-
-
-----
-messagefile outfile;
-----
-
-Swift will choose a filename, which in the present version will be in a
-subdirectory called _concurrent.
-
-
-Datatypes
-~~~~~~~~~
-All data in variables and files has a data type. So far, we've seen two
-types:
-
- - string - this is a built-in type for storing strings of text in
- memory, much like in other programming languages
- - messagefile - this is a user-defined type used to mark disc resident files as
- containing messages
-
-SwiftScript has the additional built-in types: boolean, integer and
-float that function much like their counterparts in other programming
-languages.
-
-It is also possible to create user defined types with more structure,
-for example:
-
-
-----
-type details {
- string name;
- int pies;
-}
-----
-
-Each element of the structured type can be accessed using a . like this:
-
-
-----
-person.name = "john";
-----
-
-The following complete program, types.swift, outputs a greeting using a
-user-defined structure type to hold parameters for the message:
-
-
-----
-include::../../examples/types.swift[]
-----
-
-Structured types can be comprised of marker types for files. See the
-later section on mappers for more information about this.
-
-
-Arrays
-~~~~~~
-
-We can define arrays using the [] suffix in a variable declaration:
-
-
-----
-messagefile m[];
-----
-
-This program, q5.swift, will declare an array of message files.
-
-
-----
-include::../../examples/q5.swift[]
-----
-
-Observe that the type of the parameter to greeting is now an array of
-strings, string s[], instead of a single string, string s, that
-elements of the array can be referenced numerically, for example s[0],
-and that the array is initialised using an array literal,
-["how","are","you"].
-
-
-Mappers
-~~~~~~~
-
-A significant difference between SwiftScript and other languages is that
-data can be referred to on disk through variables in a very similar
-fashion to data in memory. For example, in the above examples we have
-seen a variable definition like this:
-
-
-----
-messagefile outfile <"q13greeting.txt">;
-----
-
-This means that outfile is a dataset variable, which is mapped to a
-file on disk called g13greeting.txt. This variable can be assigned to
-using = in a similar fashion to an in-memory variable. We can say that
-outfile is mapped onto the disk file q13greeting.txt by a mapper.
-
-There are various ways of mapping in SwiftScript. Two forms have already
-been seen in this tutorial. Later exercises will introduce more forms.
-
-The two forms of mapping seen so far are:
-
-simple named mapping - the name of the file that a variable is mapped to
-is explictly listed. Like this:
-
-
-----
-messagefile outfile <"greeting.txt">;
-----
-
-This is useful when you want to explicitly name input and output files
-for your program. For example, outfile in exercise HELLOWORLD.
-
-anonymous mapping - no name is specified in the source code. A name is
-automatically generated for the file. This is useful for intermediate
-files that are only referenced through SwiftScript, such as outfile in
-exercise ANONYMOUSFILE. A variable declaration is mapped anonymously by
-ommitting any mapper definition, like this:
-
-
-----
-messagefile outfile;
-----
-
-Later exercises will introduce other ways of mapping from disk files to
-SwiftScript variables.
-
-TODO: introduce @v syntax.
-
-
-The Regexp Mapper
-^^^^^^^^^^^^^^^^^
-In this exercise, we introduce the regexp mapper. This mapper
-transforms a string expression using a regular expression, and uses the
-result of that transformation as the filename to map.
-
-regexp.swift demonstrates the use of this by placing output into a
-file that is based on the name of the input file: our input file is
-mapped to the inputfile variable using the simple named mapper, and then
-we use the regular expression mapper to map the output file. Then we use
-the countwords() procedure to count the works in the input file and
-store the result in the output file. In order for the countwords()
-procedure to work correctly, add the wc utility (usually found in
-/usr/bin/wc) to tc.data.
-
-The important bit of regexp.swift is:
-
-
-----
-messagefile inputfile <"q16.txt">;
-
-countfile c <regexp_mapper;
- source=@inputfile,
- match="(.*)txt",
- transform="\\1count"
- >;
-----
-
-fixed_array_mapper
-^^^^^^^^^^^^^^^^^^
-The fixed array mapper maps a list of files into an array - each
-element of the array is mapped into one file in the specified directory.
-See fixedarray.swift.
-
-
-----
-include::../../examples/fixedarray.swift[]
-----
-
-foreach
-~~~~~~~
-SwiftScript provides a control structure, foreach, to operate on each
-element of an array in parallel.
-
-In this example, we will run the previous word counting example over
-each file in an array without having to explicitly list the array
-elements. The source code for this example is in foreach.swift. The
-three input files: one.txt, two.txt and three.txt are supplied.
-After you have run the workflow, you should see that there are three
-output files: one.count, two.count and three.count, each
-containing the word count for the corresponding input file. We combine
-the use of the fixed_array_mapper and the regexp_mapper.
-
-
-----
-include::../../examples/foreach.swift[]
-----
-
-If
-~~
-Decisions can be made using 'if', like this:
-
-----
-if(morning) {
- outfile = greeting("good morning");
-} else {
- outfile = greeting("good afternoon");
-}
-----
-
-if.swift contains a simple example of this. Compile and run if.swift
-and see that it outputs "good morning". Changing the morning variable
-from true to false will cause the program to output "good afternoon".
-
-Sequential iteration
-~~~~~~~~~~~~~~~~~~~~
-
-A serial execution of instructions can be carried out using the sequential iteration construct.
-
-The following example demonstrates a simple application: each step of
-the iteration is a string representation of the byte count of the
-previous step's output, with iteration terminating when the byte count
-reaches zero.
-
-Here's the program:
-
-
-----
-include::../../examples/iterate.swift[]
-----
-
-Where, echo is the standard unix echo utility.
-
-_wcl_ is our application code - it counts the number of bytes in the one
-file and writes that count out to another, like this:
-
-----
-$ cat ../wcl
-#!/bin/bash
-echo -n $(wc -c < $1) > $2
-
-$ echo -n hello > a
-$ wcl a b
-$ cat b
-5
-----
-
-Install the above wcl script somewhere and add a transformation catalog
-(tc) entry for it (see an example below, note that you will need to change the path in third column to the path where wcl is located on your localhost).
-
-----
-localhost wcl /home/ketan/bin/wcl INSTALLED INTEL32::LINUX null
-----
-
-Then run the example program like this:
-
-
-----
-$ swift iterate.swift
-Swift svn swift-r3334 cog-r2752
-
-RunID: 20100526-2259-gtlz8zf4
-Progress:
-SwiftScript trace: extract int value , 16.0
-SwiftScript trace: extract int value , 2.0
-SwiftScript trace: extract int value , 1.0
-Final status: Finished successfully:4
-
-$ ls foldout*
-foldout0000 foldout0001 foldout0002 foldout0003
-----
-
-
Added: trunk/docs/tutorial/language_features
===================================================================
--- trunk/docs/tutorial/language_features (rev 0)
+++ trunk/docs/tutorial/language_features 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,390 @@
+Language features
+-----------------
+
+Parameters
+~~~~~~~~~~
+
+Procedures can have parameters. Input parameters specify inputs to the
+procedure and output parameters specify outputs. Our hello world greeting
+procedure already uses an output parameter, t, which indicates where the
+greeting output will go. In this section, we will modify the previous
+script to add an input parameter to the greeting function.
+
+.parameter.swift
+****************
+----
+include::../../examples/tutorial/parameter.swift[]
+----
+****************
+
+We have modified the signature of the greeting procedure to indicate
+that it takes a single parameter, s, of type 'string'.
+
+We have modified the invocation of the 'echo' utility so that it takes
+the value of s as a parameter, instead of the string literal "Hello,
+world!".
+
+We have modified the output file definition to point to a different file
+on disk.
+
+We have modified the invocation of greeting so that a greeting string is
+supplied.
+
+The code for this section can be found in parameter.swift. It can be
+invoked using the swift command, with output appearing in parameter.hello.txt:
+
+
+----
+$ swift parameter.swift
+----
+
+Now that we can choose our greeting text, we can call the same procedure
+with different parameters to generate several output files with
+different greetings. The code is in manyparam.swift and can be run as
+before using the swift command.
+
+.manyparam.swift
+****************
+----
+include::../../examples/tutorial/manyparam.swift[]
+----
+****************
+
+Note that we can intermingle definitions of variables with invocations
+of procedures.
+
+When this program runs, there should be three new files in the
+working directory (manyparam.english.txt, manyparam.francais.txt
+and manyparam.nihongo.txt) each containing a greeting in a different
+language.
+
+In addition to specifying parameters positionally, parameters can be
+named, and if desired a default value can be specified.
+
+Adding another application
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Now we'll define a new application procedure. The procedure we define
+will capitalise all the words in the input file.
+
+To do this, we'll use the unix tr (translate) utility. Here is an
+example of using tr on the unix command line, not using Swift:
+
+----
+$ echo hello | tr '[a-z]' '[A-Z]'
+HELLO
+----
+
+There are two main steps - updating the transformation catalog, and
+updating the application block.
+
+The transformation catalog lists where application executables are located on
+remote sites. We need to modify the transformation catalog to define a logical
+transformation for the tr utility. The transformation catalog can be found
+in etc/tc.data. There are already several entries specifying
+where executables can be found. Add a new line to the file, specifying
+where tr can be found (usually in /usr/bin/tr but it may differ on
+your system), like this:
+
+----
+localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null
+----
+
+For now, ignore all of the fields except the second and the third. The
+second field tr specifies a logical application name and the third
+specifies the location of the application executable.
+
+Now that we have defined where to find tr, we can use it in SwiftScript.
+
+We can define a new procedure, capitalise, which calls tr.
+
+----
+sys::[sed -n '7,9p' ../../examples/tutorial/capitalise.swift]
+----
+We can call capitalise like this:
+
+----
+sys::[sed -n '12,14p' ../../examples/tutorial/capitalise.swift]
+----
+
+Here is the full program based on this exercise:
+
+.capitalise.swift
+***********************
+----
+include::../../examples/tutorial/capitalise.swift[]
+----
+***********************
+
+Next, run swift and verify the output is correct.
+
+----
+$ swift capitalise.swift
+...
+$ cat capitalise.2.txt
+HELLO FROM SWIFT
+----
+
+Anonymous files
+~~~~~~~~~~~~~~~
+In the previous section, the file hello.txt is used only to store
+an intermediate result. We don't really care about which name is used
+for the file, and we can let Swift choose the name.
+
+To do that, omit the mapping entirely when declaring hellofile:
+
+----
+sys::[sed -n '11p' ../../examples/tutorial/capitalise_anonymous.swift]
+----
+
+Swift will choose a filename, which in the present version will be in a
+subdirectory called _concurrent.
+
+
+Datatypes
+~~~~~~~~~
+All data in variables and files has a data type. So far, we've seen two
+types:
+
+ - string - this is a built-in type for storing strings of text in
+ memory, much like in other programming languages
+ - messagefile - this is a user-defined type used to mark disc resident files as
+ containing messages
+
+SwiftScript has the additional built-in types: boolean, integer and
+float that function much like their counterparts in other programming
+languages.
+
+It is also possible to create user defined types with more structure,
+for example:
+
+
+----
+sys::[sed -n '3,6p' ../../examples/tutorial/types.swift]
+----
+
+Each element of the structured type can be accessed using a . like this:
+
+----
+sys::[sed -n '14p' ../../examples/tutorial/types.swift]
+----
+
+The following complete program, types.swift, outputs a greeting using a
+user-defined structure type to hold parameters for the message:
+
+.types.swift
+************
+----
+include::../../examples/tutorial/types.swift[]
+----
+************
+
+Structured types can be comprised of marker types for files. See the
+later section on mappers for more information about this.
+
+
+Arrays
+~~~~~~
+
+We can define arrays using the [] suffix in a variable declaration:
+
+----
+sys::[sed -n '9p' ../../examples/tutorial/arrays.swift]
+----
+
+This program, arrays.swift, will declare an array of message files.
+
+.arrays.swift
+*************
+----
+include::../../examples/tutorial/arrays.swift[]
+----
+*************
+
+Observe that the type of the parameter to greeting is now an array of
+strings, string s[], instead of a single string, string s, that
+elements of the array can be referenced numerically, for example s[0],
+and that the array is initialised using an array literal,
+["how","are","you"].
+
+
+Mappers
+~~~~~~~
+
+A significant difference between SwiftScript and other languages is that
+data can be referred to on disk through variables in a very similar
+fashion to data in memory. For example, in the above examples we have
+seen a variable definition like this:
+
+----
+sys::[sed -n '7p' ../../examples/tutorial/arrays.swift]
+----
+
+This means that outfile is a dataset variable, which is mapped to a
+file on disk called arrays.txt. This variable can be assigned to
+using = in a similar fashion to an in-memory variable. We can say that
+outfile is mapped onto the disk file arrays.txt by a mapper.
+
+There are various ways of mapping in SwiftScript. Two forms of mapping,
+simple named mapping and anonymous mapping, have already
+been seen in this tutorial. Later exercises will introduce more forms.
+
+In simple named mapping, the name of the file that a variable is mapped to
+is explictly listed.
+
+----
+sys::[sed -n '7p' ../../examples/tutorial/hello.swift]
+----
+
+This is useful when you want to explicitly name input and output files
+for your program. An example of this can be seen with 'outfile' in the
+hello world exercise.
+
+With anonymous mapping no name is specified in the source code. A name is
+automatically generated for the file. This is useful for intermediate
+files that are only referenced through SwiftScript.
+A variable declaration is mapped anonymously by ommitting any mapper
+definition.
+
+----
+sys::[sed -n '11p' ../../examples/tutorial/capitalise_anonymous.swift]
+----
+
+Later exercises will introduce other ways of mapping from disk files to
+SwiftScript variables.
+
+
+The Regexp Mapper
+^^^^^^^^^^^^^^^^^
+In this exercise, we introduce the regexp mapper. This mapper
+transforms a string expression using a regular expression, and uses the
+result of that transformation as the filename to map.
+
+regexp.swift demonstrates the use of this by placing output into a
+file that is based on the name of the input file. Our input file is
+mapped to the inputfile variable using the simple named mapper, then
+we use the regular expression mapper to map the output file. We then use
+the countwords() procedure to count the words in the input file and
+store the result in the output file. In order for the countwords()
+procedure to work correctly, add the wc utility (usually found in
+/usr/bin/wc) to tc.data.
+
+The following program replaces the suffix of the input file (regexp_mapper.words.txt)
+with a new suffix (.count) to create regexp_mapper.words.count.
+
+.regexp_mapper.swift
+*************
+----
+include::../../examples/tutorial/regexp_mapper.swift[]
+----
+**************
+
+fixed_array_mapper
+^^^^^^^^^^^^^^^^^^
+The fixed array mapper maps a list of files into an array. Each
+element of the array is mapped into one file in the specified directory.
+See fixed_array_mapper.swift below.
+
+.fixed_array_mapper.swift
+*************************
+----
+include::../../examples/tutorial/fixed_array_mapper.swift[]
+----
+*************************
+
+foreach
+~~~~~~~
+SwiftScript provides a control structure, foreach, to operate on each
+element of an array in parallel.
+
+In this example, we will run the previous word counting example over
+each file in an array without having to explicitly list the array
+elements. The source code for this example is in foreach.swift. This
+program uses three input files: foreach.1.txt, foreach.2.txt, and
+foreach.3.txt. After you have run the workflow, you should see that there are three
+output files: foreach.1.count, foreach.2.count and foreach.3.count, each
+containing the word count for the corresponding input file. We combine
+the use of the fixed_array_mapper and the regexp_mapper.
+
+.foreach.swift
+**************
+----
+include::../../examples/tutorial/foreach.swift[]
+----
+**************
+
+If
+~~
+Decisions can be made using 'if', like this:
+
+----
+sys::[sed -n '11,15p' ../../examples/tutorial/if.swift]
+----
+
+if.swift contains a simple example of this. Compile and run if.swift
+and see that it outputs "good morning". Changing the morning variable
+from true to false will cause the program to output "good afternoon".
+Here is the contents of the full script:
+
+.if.swift
+*********
+-----
+include::../../examples/tutorial/if.swift[]
+-----
+*********
+
+Sequential iteration
+~~~~~~~~~~~~~~~~~~~~
+
+A serial execution of instructions can be carried out using the sequential iteration construct.
+
+The following example demonstrates a simple application. Each step of
+the iteration is a string representation of the byte count of the
+previous step's output, with iteration terminating when the byte count
+reaches zero.
+
+Here's the program:
+
+.sequential_iteration.swift
+***************************
+----
+include::../../examples/tutorial/sequential_iteration.swift[]
+----
+***************************
+
+Echo is the standard unix echo utility.
+
+_wcl_ is our application code. It counts the number of bytes in the one
+file and writes that count out to another, like this:
+
+----
+$ cat ../wcl
+#!/bin/bash
+echo -n $(wc -c < $1) > $2
+
+$ echo -n hello > a
+$ wcl a b
+$ cat b
+5
+----
+
+Install the above wcl script somewhere and add a transformation catalog
+(tc) entry for it (see an example below, note that you will need to change the path in third column to the path where wcl is located on your localhost).
+
+----
+localhost wcl /home/ketan/bin/wcl INSTALLED INTEL32::LINUX null
+----
+
+Then run the example program like this:
+
+
+----
+$ swift iterate.swift
+Swift svn swift-r3334 cog-r2752
+
+RunID: 20100526-2259-gtlz8zf4
+Progress:
+SwiftScript trace: extract int value , 16.0
+SwiftScript trace: extract int value , 2.0
+SwiftScript trace: extract int value , 1.0
+Final status: Finished successfully:4
+----
Deleted: trunk/docs/tutorial/runtime_features
===================================================================
--- trunk/docs/tutorial/runtime_features 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/runtime_features 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,359 +0,0 @@
-Runtime features
-----------------
-
-Visualizing the workflow as a graph
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-When running a workflow, its possible to generate a provenance graph at
-the same time:
-
-
------
-$ swift -pgraph graph.dot first.swift
-$ dot -ograph.png -Tpng graph.dot
-----
-
-graph.png can then be viewed using your favourite image viewer. The dot application is part of the graphViz project. More information can be found at http://www.graphviz.org.
-
-Running on a remote site
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-As configured by default, all jobs are run locally. In the previous
-examples, we've invoked echo and tr executables from our SwiftScript
-program. These have been run on the local system (the same computer on
-which you ran swift). We can also make our computations run on a
-remote resource.
-
-WARNING: This example is necessarily more vague than previous ones,
-because it requires access to remote resources. You should ensure that
-you can submit a job using the globus-job-run (or globusrun-ws)
-command(s).
-
-We do not need to modify any SwiftScript code to run on another
-resource. Instead, we must modify another catalog, the site catalog.
-This catalog provides details of the location that applications will be
-run, with the default settings referring to the local machine. We will
-modify it to refer to a remote resource - the UC Teraport cluster. If
-you are not a UC Teraport user, you should use details of a different
-resource that you do have access to.
-
-The site catalog is located in etc/sites.xml and is a relatively
-straightforward XML format file. We must modify each of the following
-three settings: gridftp (which indicates how and where data can be
-transferred to the remote resource), jobmanager (which indicates how
-applications can be run on the remote resource) and workdirectory (which
-indicates where working storage can be found on the remote resource).
-
-
-Writing a mapper
-~~~~~~~~~~~~~~~~
-
-This section will introduce writing a custom mapper so that Swift is
-able to access data files laid out in application-specific ways.
-
-An application-specific mapper must take the form of a Java class that
-implements the Mapper
-<http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html>
-interface.
-
-Usually you don't need to implement this interface directly, because
-Swift provides a number of more concrete classes with some functionality
-already implemented.
-
-The hierarchy of helper classes is:
-
-http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html[Mapper]
-
-This is the abstract interface for mappers in Swift. You must
-implement methods to provide access to mapper properties, to map from a
-SwiftScript dataset path (such as foo[1].bar) to a file name, to check
-whether a file exists. None of the default Swift mappers implement this
-interface directly - instead they use one of the following helper classes.
-
-http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/AbstractMapper.html[Abstract Mapper]
-
-This provides helper methods to manage mapper properties and to handle
-existance checking. Examples of mappers which use this class are:
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.array_mapper[Array Mapper],
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.csv_mapper[CSV Mapper],
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.fixed_array_mapper[Fixed Array Mapper],
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.regexp_mapper[Regexp Mapper],
-and http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.single_file_mapper[Single File Mapper].
-
-http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/file/AbstractFileMapper.html[AbstractFileMapper]
-This provides a helper class for mappers which select files based on
-selecting files from a directory listing. It is necessary to write some
-helper methods that are different from the above mapper methods.
-Examples of mappers which use this class are:
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.simple_mapper[simple_mapper],
-http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.filesys_mapper[filesys_mapper],
-and the (undocumented) StructuredRegularExpressionMapper.
-
-In general, to write a mapper, choose either the AbstractMapper or the
-AbstractFileMapper and extend those. If your mapper will generally
-select the files it returns based on a directory listing and will
-convert paths to filenames using some regular conversion (for example,
-in the way that simple_mapper maps files in a directory that match a
-particular pattern), then you should probably use the
-AbstractFileMapper. If your mapper will produce a list of files in some
-other way (for example, in the way that csv_mapper maps based on
-filenames given in a CSV file rather than looking at which files are in
-a directory), then you should probably use the AbstractMapper.
-
-
-Writing a very basic mapper
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-In this section, we will write a very basic (almost useless) mapper that
-will map a SwiftScript dataset into a hardcoded file called
-myfile.txt, like this:
-
-
- Swift variable Filename
-
- var <-----------------------------> myfile.txt
-
-We should be able to use the mapper we write in a SwiftScript program
-like this:
-
-
-----
-type file;
-file f <my_first_mapper;>;
-----
-
-First we must choose a base class - AbstractMapper or
-AbstractFileMapper. We aren't going to use a directory listing to decide
-on our mapping - we are getting the mapping from some other source (in
-fact, it will be hard coded). So we will use AbstractMapper.
-
-So now onto the source code. We must define a subclass of AbstractMapper
-and implement several mapper methods: isStatic, existing, and map. These
-methods are documented in the javadoc for the Mapper interface.
-
-Here is the code implementing this mapper. Put this in your source
-vdsk directory, make a directory src/tutorial/|and put this file in
-src/tutorial/MyFirstMapper.java.
-
-
-----
-package tutorial;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.griphyn.vdl.mapping.AbsFile;
-import org.griphyn.vdl.mapping.AbstractMapper;
-import org.griphyn.vdl.mapping.Path;
-import org.griphyn.vdl.mapping.PhysicalFormat;
-
-public class MyFirstMapper extends AbstractMapper {
-
- AbsFile myfile = new AbsFile("myfile.txt");
-
- public boolean isStatic() {
- return false;
- }
-
- public Collection existing() {
- if (myfile.exists())
- return Arrays.asList(new Path[] {Path.EMPTY_PATH});
- else
- return Collections.EMPTY_LIST;
- }
-
- public PhysicalFormat map(Path p) {
- if(p.equals(Path.EMPTY_PATH))
- return myfile;
- else
- return null;
- }
-}
-----
-
-Now we need to inform the Swift engine about the existence of this
-mapper. We do that by editing the MapperFactory class definition, in
-src/org/griphyn/vdl/mapping/MapperFactory.java and adding a
-registerMapper call alongside the existing registerMapper calls, like this:
-
-
-----
-registerMapper("my_first_mapper", tutorial.MyFirstMapper.class);
-----
-
-The first parameter is the name of the mapper that will be used in
-SwiftScript program. The second parameter is the new Mapper class that
-we just wrote.
-
-Now rebuild Swift using the "ant redist" target.
-
-This new Swift build will be aware of your new mapper. We can test it
-out with a hello world program:
-
-
-----
-type messagefile;
-
-(messagefile t) greeting() {
- app {
- echo "hello" stdout=@filename(t);
- }
-}
-
-messagefile outfile <my_first_mapper;>;
-
-outfile = greeting();
-----
-
-Run this program, and hopefully you will find the "hello" string has
-been output into the hard coded output file myfile.txt:
-
-
-----
-$ cat myfile.txt
-hello
-----
-
-So that's a first very simple mapper implemented. Compare the source
-code to the single_file_mapper in
-http://www.ci.uchicago.edu/trac/swift/browser/trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java[SingleFileMapper.java].
-There is not much more code to the single_file_mapper - mostly code to
-deal with the file parameter.
-
-
-Starting and restarting
-~~~~~~~~~~~~~~~~~~~~~~~
-
-Now we're going to try out the restart capabilities of Swift. We will
-make a workflow that will deliberately fail, and then we will fix the
-problem so that Swift can continue with the workflow.
-
-First we have the program in working form, restart.swift.
-
-
-----
-include::../../examples/restart.swift[]
-----
-
-We must define some transformation catalog entries:
-
-
-----
-localhost touch /usr/bin/touch INSTALLED INTEL32::LINUX null
-localhost broken /bin/true INSTALLED INTEL32::LINUX null
-----
-
-Now we can run the program:
-
-
-----
-$ swift restart.swift
-Swift 0.9 swift-r2860 cog-r2388
-
-RunID: 20100526-1119-3kgzzi15
-Progress:
-Final status: Finished successfully:4
-----
-
-Four jobs run - touch, echo, broken and a final echo. (note that broken
-isn't actually broken yet).
-
-Now we will break the broken job and see what happens. Replace the
-definition in tc.data for broken with this:
-
-
-----
-localhost broken /bin/false INSTALLED INTEL32::LINUX null
-----
-
-Now when we run the workflow, the broken task fails:
-
-
-----
-$ swift restart.swift
-
-Swift 0.9 swift-r2860 cog-r2388
-
-RunID: 20100526-1121-tssdcljg
-Progress:
-Progress: Stage in:1 Finished successfully:2
-Execution failed:
- Exception in broken:
-Arguments: [process]
-Host: localhost
-Directory: restart-20100526-1121-tssdcljg/jobs/1/broken-1i6ufisj
-stderr.txt:
-stdout.txt:
-----
-
-From the output we can see that touch and the first echo completed, but
-then broken failed and so swift did not attempt to execute the final echo.
-
-There will be a restart log with the same name as the RunID:
-
-
-----
-$ ls *20100526-1121-tssdcljg*rlog
-restart-20100526-1121-tssdcljg.0.rlog
-----
-
-This restart log contains enough information for swift to know which
-parts of the workflow were executed successfully.
-
-We can try to rerun it immediately, like this:
-
-
-----
-$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
-
-Swift 0.9 swift-r2860 cog-r2388
-
-RunID: 20100526-1125-7yx0zi6d
-Progress:
-Execution failed:
- Exception in broken:
-Arguments: [process]
-Host: localhost
-Directory: restart-20100526-1125-7yx0zi6d/jobs/m/broken-msn1gisj
-stderr.txt:
-stdout.txt:
-
-Caused by:
- Exit code 1
-----
-
-Swift tried to resume the workflow by executing "broken" again. It did
-not try to run the touch or first echo jobs, because the restart log
-says that they do not need to be executed again.
-
-Broken failed again, leaving the original restart log in place.
-
-Now we will fix the problem with "broken" by restoring the original
-tc.data line that works.
-
-Remove the existing "broken" line and replace it with the successful
-tc.data entry above:
-
-
-----
-localhost broken /bin/true INSTALLED INTEL32::LINUX null
-----
-
-Now run again:
-
-
-----
-$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
-
-Swift 0.9 swift-r2860 cog-r2388
-
-RunID: 20100526-1128-a2gfuxhg
-Progress:
-Final status: Initializing:2 Finished successfully:2
-----
-
-Swift tries to run "broken" again. This time it works, and so Swift
-continues on to execute the final piece of the workflow as if nothing
-had ever gone wrong.
-
Added: trunk/docs/tutorial/runtime_features
===================================================================
--- trunk/docs/tutorial/runtime_features (rev 0)
+++ trunk/docs/tutorial/runtime_features 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,317 @@
+Runtime features
+----------------
+
+Visualizing the workflow as a graph
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When running a workflow, its possible to generate a provenance graph at
+the same time:
+
+
+-----
+$ swift -pgraph graph.dot first.swift
+$ dot -ograph.png -Tpng graph.dot
+----
+
+graph.png can then be viewed using your favourite image viewer. The dot application is part of the graphViz project. More information can be found at http://www.graphviz.org.
+
+Running on a remote site
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+As configured by default, all jobs are run locally. In the previous
+examples, we've invoked echo and tr executables from our SwiftScript
+program. These have been run on the local system (the same computer on
+which you ran swift). We can also make our computations run on a
+remote resource.
+
+WARNING: This example is necessarily more vague than previous ones,
+because it requires access to remote resources. You should ensure that
+you can submit a job using the globus-job-run (or globusrun-ws)
+command(s).
+
+We do not need to modify any SwiftScript code to run on another
+resource. Instead, we must modify another catalog, the site catalog.
+This catalog provides details of the location that applications will be
+run, with the default settings referring to the local machine. We will
+modify it to refer to a remote resource - the UC Teraport cluster. If
+you are not a UC Teraport user, you should use details of a different
+resource that you do have access to.
+
+The site catalog is located in etc/sites.xml and is a relatively
+straightforward XML format file. We must modify each of the following
+three settings: gridftp (which indicates how and where data can be
+transferred to the remote resource), jobmanager (which indicates how
+applications can be run on the remote resource) and workdirectory (which
+indicates where working storage can be found on the remote resource).
+
+
+Writing a mapper
+~~~~~~~~~~~~~~~~
+
+This section will introduce writing a custom mapper so that Swift is
+able to access data files laid out in application-specific ways.
+
+An application-specific mapper must take the form of a Java class that
+implements the http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html[Mapper
+interface].
+
+Usually you don't need to implement this interface directly, because
+Swift provides a number of more concrete classes with some functionality
+already implemented.
+
+The hierarchy of helper classes is:
+
+http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html[Mapper]
+
+This is the abstract interface for mappers in Swift. You must
+implement methods to provide access to mapper properties, to map from a
+SwiftScript dataset path (such as foo[1].bar) to a file name, to check
+whether a file exists. None of the default Swift mappers implement this
+interface directly - instead they use one of the following helper classes.
+
+http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/AbstractMapper.html[Abstract Mapper]
+
+This provides helper methods to manage mapper properties and to handle
+existance checking. Examples of mappers which use this class are:
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.array_mapper[Array Mapper],
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.csv_mapper[CSV Mapper],
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.fixed_array_mapper[Fixed Array Mapper],
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.regexp_mapper[Regexp Mapper],
+and http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.single_file_mapper[Single File Mapper].
+
+http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/file/AbstractFileMapper.html[AbstractFileMapper]
+This provides a helper class for mappers which select files based on
+selecting files from a directory listing. It is necessary to write some
+helper methods that are different from the above mapper methods.
+Examples of mappers which use this class are:
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.simple_mapper[simple_mapper],
+http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.filesys_mapper[filesys_mapper],
+and the StructuredRegularExpressionMapper.
+
+In general, to write a mapper, choose either the AbstractMapper or the
+AbstractFileMapper and extend those. If your mapper will generally
+select the files it returns based on a directory listing and will
+convert paths to filenames using some regular conversion (for example,
+in the way that simple_mapper maps files in a directory that match a
+particular pattern), then you should probably use the
+AbstractFileMapper. If your mapper will produce a list of files in some
+other way (for example, in the way that csv_mapper maps based on
+filenames given in a CSV file rather than looking at which files are in
+a directory), then you should probably use the AbstractMapper.
+
+
+Writing a very basic mapper
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In this section, we will write a very basic (almost useless) mapper that
+will map a SwiftScript dataset into a hardcoded file called
+myfile.txt, like this:
+
+
+ Swift variable Filename
+
+ var <-----------------------------> myfile.txt
+
+We should be able to use the mapper we write in a SwiftScript program
+like this:
+
+
+----
+type file;
+file f <my_first_mapper>;
+----
+
+First we must choose a base class - AbstractMapper or
+AbstractFileMapper. We aren't going to use a directory listing to decide
+on our mapping - we are getting the mapping from some other source (in
+fact, it will be hard coded). So we will use AbstractMapper.
+
+So now onto the source code. We must define a subclass of AbstractMapper
+and implement several mapper methods: isStatic, existing, and map. These
+methods are documented in the javadoc for the Mapper interface.
+
+Here is the code implementing this mapper. Put this in your source
+vdsk directory, make a directory src/tutorial/|and put this file in
+src/tutorial/MyFirstMapper.java.
+
+.MyFirstMapper.java
+*******************
+----
+include::../../examples/tutorial/MyFirstMapper.java[]
+----
+*******************
+
+Now we need to inform the Swift engine about the existence of this
+mapper. We do that by editing the MapperFactory class definition, in
+src/org/griphyn/vdl/mapping/MapperFactory.java and adding a
+registerMapper call alongside the existing registerMapper calls, like this:
+
+
+----
+registerMapper("my_first_mapper", tutorial.MyFirstMapper.class);
+----
+
+The first parameter is the name of the mapper that will be used in
+SwiftScript program. The second parameter is the new Mapper class that
+we just wrote.
+
+Now rebuild Swift using the "ant redist" target.
+
+This new Swift build will be aware of your new mapper. We can test it
+out with a hello world program:
+
+.my_first_mapper.swift
+**********************
+-----
+include::../../examples/tutorial/my_first_mapper.swift[]
+-----
+**********************
+
+Run this program, and hopefully you will find the "hello" string has
+been output into the hard coded output file myfile.txt:
+
+
+----
+$ cat myfile.txt
+hello
+----
+
+So that's a first very simple mapper implemented. Compare the source
+code to the single_file_mapper in
+http://www.ci.uchicago.edu/trac/swift/browser/trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java[SingleFileMapper.java].
+There is not much more code to the single_file_mapper - mostly code to
+deal with the file parameter.
+
+
+Starting and restarting
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Now we're going to try out the restart capabilities of Swift. We will
+make a workflow that will deliberately fail, and then we will fix the
+problem so that Swift can continue with the workflow.
+
+First we have the program in working form, restart.swift.
+
+.restart.swift
+**************
+----
+include::../../examples/tutorial/restart.swift[]
+----
+**************
+
+We must define some transformation catalog entries:
+
+----
+localhost touch /usr/bin/touch INSTALLED INTEL32::LINUX null
+localhost broken /bin/true INSTALLED INTEL32::LINUX null
+----
+
+Now we can run the program:
+
+----
+$ swift restart.swift
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1119-3kgzzi15
+Progress:
+Final status: Finished successfully:4
+----
+
+Four jobs run - touch, echo, broken and a final echo. (note that broken
+isn't actually broken yet).
+
+Now we will break the broken job and see what happens. Replace the
+definition in tc.data for broken with this:
+
+----
+localhost broken /bin/false INSTALLED INTEL32::LINUX null
+----
+
+Now when we run the workflow, the broken task fails:
+
+----
+$ swift restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1121-tssdcljg
+Progress:
+Progress: Stage in:1 Finished successfully:2
+Execution failed:
+ Exception in broken:
+Arguments: [process]
+Host: localhost
+Directory: restart-20100526-1121-tssdcljg/jobs/1/broken-1i6ufisj
+stderr.txt:
+stdout.txt:
+----
+
+From the output we can see that touch and the first echo completed, but
+then broken failed and so swift did not attempt to execute the final echo.
+
+There will be a restart log with the same name as the RunID:
+
+
+----
+$ ls *20100526-1121-tssdcljg*rlog
+restart-20100526-1121-tssdcljg.0.rlog
+----
+
+This restart log contains enough information for swift to know which
+parts of the workflow were executed successfully.
+
+We can try to rerun it immediately, like this:
+
+
+----
+$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1125-7yx0zi6d
+Progress:
+Execution failed:
+ Exception in broken:
+Arguments: [process]
+Host: localhost
+Directory: restart-20100526-1125-7yx0zi6d/jobs/m/broken-msn1gisj
+stderr.txt:
+stdout.txt:
+
+Caused by:
+ Exit code 1
+----
+
+Swift tried to resume the workflow by executing "broken" again. It did
+not try to run the touch or first echo jobs, because the restart log
+says that they do not need to be executed again.
+
+Broken failed again, leaving the original restart log in place.
+
+Now we will fix the problem with "broken" by restoring the original
+tc.data line that works.
+
+Remove the existing "broken" line and replace it with the successful
+tc.data entry above:
+
+
+----
+localhost broken /bin/true INSTALLED INTEL32::LINUX null
+----
+
+Now run again:
+
+
+----
+$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1128-a2gfuxhg
+Progress:
+Final status: Initializing:2 Finished successfully:2
+----
+
+Swift tries to run "broken" again. This time it works, and so Swift
+continues on to execute the final piece of the workflow as if nothing
+had ever gone wrong.
Added: trunk/docs/tutorial/tutorial.html
===================================================================
--- trunk/docs/tutorial/tutorial.html (rev 0)
+++ trunk/docs/tutorial/tutorial.html 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,1507 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.5.2" />
+<title>A Swift Tutorial</title>
+<style type="text/css">
+/* Debug borders */
+p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
+/*
+ border: 1px solid red;
+*/
+}
+
+body {
+ margin: 1em 5% 1em 5%;
+}
+
+a {
+ color: blue;
+ text-decoration: underline;
+}
+a:visited {
+ color: fuchsia;
+}
+
+em {
+ font-style: italic;
+ color: navy;
+}
+
+strong {
+ font-weight: bold;
+ color: #083194;
+}
+
+tt {
+ color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #527bbd;
+ font-family: sans-serif;
+ margin-top: 1.2em;
+ margin-bottom: 0.5em;
+ line-height: 1.3;
+}
+
+h1, h2, h3 {
+ border-bottom: 2px solid silver;
+}
+h2 {
+ padding-top: 0.5em;
+}
+h3 {
+ float: left;
+}
+h3 + * {
+ clear: left;
+}
+
+div.sectionbody {
+ font-family: serif;
+ margin-left: 0;
+}
+
+hr {
+ border: 1px solid silver;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+ margin-top: 0;
+}
+
+pre {
+ padding: 0;
+ margin: 0;
+}
+
+span#author {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+ font-family: sans-serif;
+}
+
+div#footer {
+ font-family: sans-serif;
+ font-size: small;
+ border-top: 2px solid silver;
+ padding-top: 0.5em;
+ margin-top: 4.0em;
+}
+div#footer-text {
+ float: left;
+ padding-bottom: 0.5em;
+}
+div#footer-badges {
+ float: right;
+ padding-bottom: 0.5em;
+}
+
+div#preamble {
+ margin-top: 1.5em;
+ margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+ margin-top: 1.0em;
+ margin-bottom: 1.5em;
+}
+div.admonitionblock {
+ margin-top: 2.0em;
+ margin-bottom: 2.0em;
+ margin-right: 10%;
+ color: #606060;
+}
+
+div.content { /* Block element content. */
+ padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ text-align: left;
+ margin-top: 1.0em;
+ margin-bottom: 0.5em;
+}
+div.title + * {
+ margin-top: 0;
+}
+
+td div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content + div.title {
+ margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+
+div.listingblock > div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+ padding-left: 1.0em;
+ margin-left: 1.0em;
+ margin-right: 10%;
+ border-left: 5px solid #dddddd;
+ color: #777777;
+}
+
+div.quoteblock > div.attribution {
+ padding-top: 0.5em;
+ text-align: right;
+}
+
+div.verseblock > div.content {
+ white-space: pre;
+}
+div.verseblock > div.attribution {
+ padding-top: 0.75em;
+ text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+ text-align: left;
+}
+
+div.admonitionblock .icon {
+ vertical-align: top;
+ font-size: 1.1em;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #527bbd;
+ padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+ padding-left: 0.5em;
+ border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+ border-left: 3px solid #dddddd;
+ padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+dt {
+ margin-top: 0.5em;
+ margin-bottom: 0;
+ font-style: normal;
+ color: navy;
+}
+dd > *:first-child {
+ margin-top: 0.1em;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+ol.arabic {
+ list-style-type: decimal;
+}
+ol.loweralpha {
+ list-style-type: lower-alpha;
+}
+ol.upperalpha {
+ list-style-type: upper-alpha;
+}
+ol.lowerroman {
+ list-style-type: lower-roman;
+}
+ol.upperroman {
+ list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+ margin-top: 0.1em;
+ margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+ border: 3px solid #527bbd;
+}
+thead, p.table.header {
+ font-family: sans-serif;
+ font-weight: bold;
+}
+tfoot {
+ font-weight: bold;
+}
+td > div.verse {
+ white-space: pre;
+}
+p.table {
+ margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+ border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+ border-left-style: none;
+ border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+ border-top-style: none;
+ border-bottom-style: none;
+}
+
+
+div.hdlist {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+div.hdlist tr {
+ padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+ font-weight: bold;
+}
+td.hdlist1 {
+ vertical-align: top;
+ font-style: normal;
+ padding-right: 0.8em;
+ color: navy;
+}
+td.hdlist2 {
+ vertical-align: top;
+}
+div.hdlist.compact tr {
+ margin: 0;
+ padding-bottom: 0;
+}
+
+.comment {
+ background: yellow;
+}
+
+.footnote, .footnoteref {
+ font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+ vertical-align: super;
+}
+
+#footnotes {
+ margin: 20px 0 20px 0;
+ padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+ margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+ border: none;
+ border-top: 1px solid silver;
+ height: 1px;
+ text-align: left;
+ margin-left: 0;
+ width: 20%;
+ min-width: 100px;
+}
+
+
+ at media print {
+ div#footer-badges { display: none; }
+}
+
+div#toc {
+ margin-bottom: 2.5em;
+}
+
+div#toctitle {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 1.0em;
+ margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+div.toclevel2 {
+ margin-left: 2em;
+ font-size: 0.9em;
+}
+div.toclevel3 {
+ margin-left: 4em;
+ font-size: 0.9em;
+}
+div.toclevel4 {
+ margin-left: 6em;
+ font-size: 0.9em;
+}
+/* Workarounds for IE6's broken and incomplete CSS2. */
+
+div.sidebar-content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+div.sidebar-title, div.image-title {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ margin-top: 0.0em;
+ margin-bottom: 0.5em;
+}
+
+div.listingblock div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock-attribution {
+ padding-top: 0.5em;
+ text-align: right;
+}
+
+div.verseblock-content {
+ white-space: pre;
+}
+div.verseblock-attribution {
+ padding-top: 0.75em;
+ text-align: left;
+}
+
+div.exampleblock-content {
+ border-left: 3px solid #dddddd;
+ padding-left: 0.5em;
+}
+
+/* IE6 sets dynamically generated links as visited. */
+div#toc a:visited { color: blue; }
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes(); asciidoc.toc(2);}
+var asciidoc = { // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+ function getText(el) {
+ var text = "";
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+ text += i.data;
+ else if (i.firstChild != null)
+ text += getText(i);
+ }
+ return text;
+ }
+
+ function TocEntry(el, text, toclevel) {
+ this.element = el;
+ this.text = text;
+ this.toclevel = toclevel;
+ }
+
+ function tocEntries(el, toclevels) {
+ var result = new Array;
+ var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ // Function that scans the DOM tree for header elements (the DOM2
+ // nodeIterator API would be a better technique but not supported by all
+ // browsers).
+ var iterate = function (el) {
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+ var mo = re.exec(i.tagName);
+ if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+ result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+ }
+ iterate(i);
+ }
+ }
+ }
+ iterate(el);
+ return result;
+ }
+
+ var toc = document.getElementById("toc");
+ var entries = tocEntries(document.getElementById("content"), toclevels);
+ for (var i = 0; i < entries.length; ++i) {
+ var entry = entries[i];
+ if (entry.element.id == "")
+ entry.element.id = "_toc_" + i;
+ var a = document.createElement("a");
+ a.href = "#" + entry.element.id;
+ a.appendChild(document.createTextNode(entry.text));
+ var div = document.createElement("div");
+ div.appendChild(a);
+ div.className = "toclevel" + entry.toclevel;
+ toc.appendChild(div);
+ }
+ if (entries.length == 0)
+ toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+ var cont = document.getElementById("content");
+ var noteholder = document.getElementById("footnotes");
+ var spans = cont.getElementsByTagName("span");
+ var refs = {};
+ var n = 0;
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnote") {
+ n++;
+ // Use [\s\S] in place of . so multi-line matches work.
+ // Because JavaScript has no s (dotall) regex flag.
+ note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+ noteholder.innerHTML +=
+ "<div class='footnote' id='_footnote_" + n + "'>" +
+ "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+ n + "</a>. " + note + "</div>";
+ spans[i].innerHTML =
+ "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ var id =spans[i].getAttribute("id");
+ if (id != null) refs["#"+id] = n;
+ }
+ }
+ if (n == 0)
+ noteholder.parentNode.removeChild(noteholder);
+ else {
+ // Process footnoterefs.
+ for (i=0; i<spans.length; i++) {
+ if (spans[i].className == "footnoteref") {
+ var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+ href = href.match(/#.*/)[0]; // Because IE return full URL.
+ n = refs[href];
+ spans[i].innerHTML =
+ "[<a href='#_footnote_" + n +
+ "' title='View footnote' class='footnote'>" + n + "</a>]";
+ }
+ }
+ }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body style="max-width:750px">
+<div id="header">
+<h1>A Swift Tutorial</h1>
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+</div>
+<div id="content">
+<h2 id="_introduction">1. Introduction</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>This is an introductory tutorial describing the use of Swift and its programming
+language SwiftScript. It is intended to introduce new users to the basics of Swift.
+It is structured as a series of simple exercises/examples which you can
+try for yourself as you read along.</p></div>
+<div class="paragraph"><p>For information on getting an installation of Swift running, consult the
+<a href="http://www.ci.uchicago.edu/swift/guides/quickstartguide.php">Swift Quickstart Guide</a>. We advise you to install the latest stable release of Swift.
+Return to this document when you have successfully run the test SwiftScript program mentioned there.</p></div>
+<div class="paragraph"><p>There is also a
+<a href="http://www.ci.uchicago.edu/swift/guides/trunk/userguide/userguide.html">Swift User Guide</a>
+which contains a more detailed reference material on topics covered in this manual. All
+of the programs included in this tutorial can be found in your Swift
+distribution in the examples/tutorial directory.</p></div>
+</div>
+<h2 id="_hello_world">2. Hello World</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The first example program, hello.swift, outputs a hello world message
+into a file called hello.txt.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">hello.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting() {
+ echo "Hello, world!" stdout=@filename(t);
+}
+
+messagefile outfile <"hello.txt">;
+
+outfile = greeting();</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>To run hello.swift, change directories to the location of the script
+and run the swift command as follows.</p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<img src="./images/icons/tip.png" alt="Tip" />
+</td>
+<td class="content">Make sure the bin directory of your swift installation is in your PATH.</td>
+</tr></table>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cd examples/tutorial
+$ swift hello.swift
+Swift svn swift-r3334 (swift modified locally) cog-r2752
+
+RunID: 20100526-1925-8zjupq1b
+Progress:
+Final status: Finished successfully:1
+$ cat hello.txt
+Hello, world!</tt></pre>
+</div></div>
+<div class="paragraph"><p>The basic structure of this program is a type definition, an
+application procedure definition, a variable definition and then a
+call to the procedure.</p></div>
+<div class="paragraph"><p>First we define a new type, called messagefile. In this example, we will
+use this messagefile type for our output message.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;</tt></pre>
+</div></div>
+<div class="paragraph"><p>All data in SwiftScript must be typed, whether it is stored in memory or
+on disk. This example defines a very simple type. Later on we will see
+more complex type examples.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>app (messagefile t) greeting() {
+ echo "Hello, world!" stdout=@filename(t);
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>Next we define a procedure called greeting. This procedure will write
+out the "hello world" message to a file. To achieve this, it executes
+the unix utility <em>echo</em> with a parameter "Hello, world!" and directs
+the standard output into the output file.</p></div>
+<div class="paragraph"><p>The actual file to use is specified by the return parameter, t.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile outfile <"hello.txt">;</tt></pre>
+</div></div>
+<div class="paragraph"><p>Here we define a variable called outfile. The type of this variable is
+messagefile, and we specify that the contents of this variable will be
+stored on disk in a file called hello.txt</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>app (messagefile t) greeting() {
+ echo "Hello, world!" stdout=@filename(t);
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now we call the greeting procedure, with its output going to the outfile
+variable and therefore to hello.txt on disk.</p></div>
+<div class="paragraph"><p>Over the following exercises, we’ll extend this simple hello world
+program to demonstrate various features of Swift.</p></div>
+</div>
+<h2 id="_language_features">3. Language features</h2>
+<div class="sectionbody">
+<h3 id="_parameters">3.1. Parameters</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Procedures can have parameters. Input parameters specify inputs to the
+procedure and output parameters specify outputs. Our hello world greeting
+procedure already uses an output parameter, t, which indicates where the
+greeting output will go. In this section, we will modify the previous
+script to add an input parameter to the greeting function.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">parameter.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"parameter.hello.txt">;
+outfile = greeting("hello world");</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>We have modified the signature of the greeting procedure to indicate
+that it takes a single parameter, s, of type <em>string</em>.</p></div>
+<div class="paragraph"><p>We have modified the invocation of the <em>echo</em> utility so that it takes
+the value of s as a parameter, instead of the string literal "Hello,
+world!".</p></div>
+<div class="paragraph"><p>We have modified the output file definition to point to a different file
+on disk.</p></div>
+<div class="paragraph"><p>We have modified the invocation of greeting so that a greeting string is
+supplied.</p></div>
+<div class="paragraph"><p>The code for this section can be found in parameter.swift. It can be
+invoked using the swift command, with output appearing in parameter.hello.txt:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift parameter.swift</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now that we can choose our greeting text, we can call the same procedure
+with different parameters to generate several output files with
+different greetings. The code is in manyparam.swift and can be run as
+before using the swift command.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">manyparam.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile english <"manyparam.english.txt">;
+messagefile french <"manyparam.french.txt">;
+messagefile japanese <"manyparam.japanese.txt">;
+
+english = greeting("hello");
+french = greeting("bonjour");
+japanese = greeting("konnichiwa");</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Note that we can intermingle definitions of variables with invocations
+of procedures.</p></div>
+<div class="paragraph"><p>When this program runs, there should be three new files in the
+working directory (manyparam.english.txt, manyparam.francais.txt
+and manyparam.nihongo.txt) each containing a greeting in a different
+language.</p></div>
+<div class="paragraph"><p>In addition to specifying parameters positionally, parameters can be
+named, and if desired a default value can be specified.</p></div>
+<h3 id="_adding_another_application">3.2. Adding another application</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now we’ll define a new application procedure. The procedure we define
+will capitalise all the words in the input file.</p></div>
+<div class="paragraph"><p>To do this, we’ll use the unix tr (translate) utility. Here is an
+example of using tr on the unix command line, not using Swift:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ echo hello | tr '[a-z]' '[A-Z]'
+HELLO</tt></pre>
+</div></div>
+<div class="paragraph"><p>There are two main steps - updating the transformation catalog, and
+updating the application block.</p></div>
+<div class="paragraph"><p>The transformation catalog lists where application executables are located on
+remote sites. We need to modify the transformation catalog to define a logical
+transformation for the tr utility. The transformation catalog can be found
+in etc/tc.data. There are already several entries specifying
+where executables can be found. Add a new line to the file, specifying
+where tr can be found (usually in /usr/bin/tr but it may differ on
+your system), like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null</tt></pre>
+</div></div>
+<div class="paragraph"><p>For now, ignore all of the fields except the second and the third. The
+second field tr specifies a logical application name and the third
+specifies the location of the application executable.</p></div>
+<div class="paragraph"><p>Now that we have defined where to find tr, we can use it in SwiftScript.</p></div>
+<div class="paragraph"><p>We can define a new procedure, capitalise, which calls tr.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>We can call capitalise like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile final <"capitalise.2.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);</tt></pre>
+</div></div>
+<div class="paragraph"><p>Here is the full program based on this exercise:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">capitalise.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}
+
+messagefile hellofile <"capitalise.1.txt">;
+messagefile final <"capitalise.2.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Next, run swift and verify the output is correct.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift capitalise.swift
+...
+$ cat capitalise.2.txt
+HELLO FROM SWIFT</tt></pre>
+</div></div>
+<h3 id="_anonymous_files">3.3. Anonymous files</h3><div style="clear:left"></div>
+<div class="paragraph"><p>In the previous section, the file hello.txt is used only to store
+an intermediate result. We don’t really care about which name is used
+for the file, and we can let Swift choose the name.</p></div>
+<div class="paragraph"><p>To do that, omit the mapping entirely when declaring hellofile:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile hellofile;</tt></pre>
+</div></div>
+<div class="paragraph"><p>Swift will choose a filename, which in the present version will be in a
+subdirectory called _concurrent.</p></div>
+<h3 id="_datatypes">3.4. Datatypes</h3><div style="clear:left"></div>
+<div class="paragraph"><p>All data in variables and files has a data type. So far, we’ve seen two
+types:</p></div>
+<div class="ulist"><ul>
+<li>
+<p>
+string - this is a built-in type for storing strings of text in
+ memory, much like in other programming languages
+</p>
+</li>
+<li>
+<p>
+messagefile - this is a user-defined type used to mark disc resident files as
+ containing messages
+</p>
+</li>
+</ul></div>
+<div class="paragraph"><p>SwiftScript has the additional built-in types: boolean, integer and
+float that function much like their counterparts in other programming
+languages.</p></div>
+<div class="paragraph"><p>It is also possible to create user defined types with more structure,
+for example:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type details {
+ string name;
+ int pies;
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>Each element of the structured type can be accessed using a . like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>person.name = "John";</tt></pre>
+</div></div>
+<div class="paragraph"><p>The following complete program, types.swift, outputs a greeting using a
+user-defined structure type to hold parameters for the message:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">types.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+type details {
+ string name;
+ int pies;
+}
+
+app (messagefile t) greeting (details d) {
+ echo "Hello. Your name is" d.name "and you have eaten" d.pies "pies." stdout=@filename(t);
+}
+
+details person;
+
+person.name = "John";
+person.pies = 3;
+
+messagefile outfile <"types.pies.txt">;
+
+outfile = greeting(person);</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Structured types can be comprised of marker types for files. See the
+later section on mappers for more information about this.</p></div>
+<h3 id="_arrays">3.5. Arrays</h3><div style="clear:left"></div>
+<div class="paragraph"><p>We can define arrays using the [] suffix in a variable declaration:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>string words[] = ["how","are","you"];</tt></pre>
+</div></div>
+<div class="paragraph"><p>This program, arrays.swift, will declare an array of message files.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">arrays.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting (string s[]) {
+ echo s[0] s[1] s[2] stdout=@filename(t);
+}
+
+messagefile outfile <"arrays.txt">;
+
+string words[] = ["how","are","you"];
+
+outfile = greeting(words);</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Observe that the type of the parameter to greeting is now an array of
+strings, string s[], instead of a single string, string s, that
+elements of the array can be referenced numerically, for example s[0],
+and that the array is initialised using an array literal,
+["how","are","you"].</p></div>
+<h3 id="_mappers">3.6. Mappers</h3><div style="clear:left"></div>
+<div class="paragraph"><p>A significant difference between SwiftScript and other languages is that
+data can be referred to on disk through variables in a very similar
+fashion to data in memory. For example, in the above examples we have
+seen a variable definition like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile outfile <"arrays.txt">;</tt></pre>
+</div></div>
+<div class="paragraph"><p>This means that outfile is a dataset variable, which is mapped to a
+file on disk called arrays.txt. This variable can be assigned to
+using = in a similar fashion to an in-memory variable. We can say that
+outfile is mapped onto the disk file arrays.txt by a mapper.</p></div>
+<div class="paragraph"><p>There are various ways of mapping in SwiftScript. Two forms of mapping,
+simple named mapping and anonymous mapping, have already
+been seen in this tutorial. Later exercises will introduce more forms.</p></div>
+<div class="paragraph"><p>In simple named mapping, the name of the file that a variable is mapped to
+is explictly listed.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile outfile <"hello.txt">;</tt></pre>
+</div></div>
+<div class="paragraph"><p>This is useful when you want to explicitly name input and output files
+for your program. An example of this can be seen with <em>outfile</em> in the
+hello world exercise.</p></div>
+<div class="paragraph"><p>With anonymous mapping no name is specified in the source code. A name is
+automatically generated for the file. This is useful for intermediate
+files that are only referenced through SwiftScript.
+A variable declaration is mapped anonymously by ommitting any mapper
+definition.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>messagefile hellofile;</tt></pre>
+</div></div>
+<div class="paragraph"><p>Later exercises will introduce other ways of mapping from disk files to
+SwiftScript variables.</p></div>
+<h4 id="_the_regexp_mapper">3.6.1. The Regexp Mapper</h4>
+<div class="paragraph"><p>In this exercise, we introduce the regexp mapper. This mapper
+transforms a string expression using a regular expression, and uses the
+result of that transformation as the filename to map.</p></div>
+<div class="paragraph"><p>regexp.swift demonstrates the use of this by placing output into a
+file that is based on the name of the input file. Our input file is
+mapped to the inputfile variable using the simple named mapper, then
+we use the regular expression mapper to map the output file. We then use
+the countwords() procedure to count the words in the input file and
+store the result in the output file. In order for the countwords()
+procedure to work correctly, add the wc utility (usually found in
+/usr/bin/wc) to tc.data.</p></div>
+<div class="paragraph"><p>The following program replaces the suffix of the input file (regexp_mapper.words.txt)
+with a new suffix (.count) to create regexp_mapper.words.count.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">regexp_mapper.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+messagefile inputfile <"regexp_mapper.words.txt">;
+
+countfile c <regexp_mapper;
+ source=@inputfile,
+ match="(.*)txt",
+ transform="\\1count">;
+
+c = countwords(inputfile);</tt></pre>
+</div></div>
+</div></div>
+<h4 id="_fixed_array_mapper">3.6.2. fixed_array_mapper</h4>
+<div class="paragraph"><p>The fixed array mapper maps a list of files into an array. Each
+element of the array is mapped into one file in the specified directory.
+See fixed_array_mapper.swift below.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">fixed_array_mapper.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "fixed_array_mapper.1.txt fixed_array_mapper.2.txt fixed_array_mapper.3.txt";
+string outputNames = "fixed_array_mapper.1.count fixed_array_mapper.2.count fixed_array_mapper.3.count";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+countfile outputfiles[] <fixed_array_mapper;files=outputNames>;
+
+outputfiles[0] = countwords(inputfiles[0]);
+outputfiles[1] = countwords(inputfiles[1]);
+outputfiles[2] = countwords(inputfiles[2]);</tt></pre>
+</div></div>
+</div></div>
+<h3 id="_foreach">3.7. foreach</h3><div style="clear:left"></div>
+<div class="paragraph"><p>SwiftScript provides a control structure, foreach, to operate on each
+element of an array in parallel.</p></div>
+<div class="paragraph"><p>In this example, we will run the previous word counting example over
+each file in an array without having to explicitly list the array
+elements. The source code for this example is in foreach.swift. This
+program uses three input files: foreach.1.txt, foreach.2.txt, and
+foreach.3.txt. After you have run the workflow, you should see that there are three
+output files: foreach.1.count, foreach.2.count and foreach.3.count, each
+containing the word count for the corresponding input file. We combine
+the use of the fixed_array_mapper and the regexp_mapper.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">foreach.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "foreach.1.txt foreach.2.txt foreach.3.txt";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+
+foreach f in inputfiles {
+ countfile c<regexp_mapper;
+ source=@f,
+ match="(.*)txt",
+ transform="\\1count">;
+ c = countwords(f);
+}</tt></pre>
+</div></div>
+</div></div>
+<h3 id="_if">3.8. If</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Decisions can be made using <em>if</em>, like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>if(morning) {
+ outfile = greeting("good morning");
+} else {
+ outfile = greeting("good afternoon");
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>if.swift contains a simple example of this. Compile and run if.swift
+and see that it outputs "good morning". Changing the morning variable
+from true to false will cause the program to output "good afternoon".
+Here is the contents of the full script:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">if.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"if.txt">;
+
+boolean morning = true;
+
+if(morning) {
+ outfile = greeting("good morning");
+} else {
+ outfile = greeting("good afternoon");
+}</tt></pre>
+</div></div>
+</div></div>
+<h3 id="_sequential_iteration">3.9. Sequential iteration</h3><div style="clear:left"></div>
+<div class="paragraph"><p>A serial execution of instructions can be carried out using the sequential iteration construct.</p></div>
+<div class="paragraph"><p>The following example demonstrates a simple application. Each step of
+the iteration is a string representation of the byte count of the
+previous step’s output, with iteration terminating when the byte count
+reaches zero.</p></div>
+<div class="paragraph"><p>Here’s the program:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">sequential_iteration.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type counterfile;
+
+app (counterfile t) echo(string m) {
+ echo m stdout=@filename(t);
+}
+
+app (counterfile t) countstep(counterfile i) {
+ wcl @filename(i) @filename(t);
+}
+
+counterfile a[] <simple_mapper;prefix="sequential_iteration.foldout">;
+
+a[0] = echo("793578934574893");
+
+iterate v {
+ a[v+1] = countstep(a[v]);
+ trace("extract int value ", at extractint(a[v+1]));
+} until (@extractint(a[v+1]) <= 1);</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Echo is the standard unix echo utility.</p></div>
+<div class="paragraph"><p><em>wcl</em> is our application code. It counts the number of bytes in the one
+file and writes that count out to another, like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat ../wcl
+#!/bin/bash
+echo -n $(wc -c < $1) > $2
+
+$ echo -n hello > a
+$ wcl a b
+$ cat b
+5</tt></pre>
+</div></div>
+<div class="paragraph"><p>Install the above wcl script somewhere and add a transformation catalog
+(tc) entry for it (see an example below, note that you will need to change the path in third column to the path where wcl is located on your localhost).</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>localhost wcl /home/ketan/bin/wcl INSTALLED INTEL32::LINUX null</tt></pre>
+</div></div>
+<div class="paragraph"><p>Then run the example program like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift iterate.swift
+Swift svn swift-r3334 cog-r2752
+
+RunID: 20100526-2259-gtlz8zf4
+Progress:
+SwiftScript trace: extract int value , 16.0
+SwiftScript trace: extract int value , 2.0
+SwiftScript trace: extract int value , 1.0
+Final status: Finished successfully:4</tt></pre>
+</div></div>
+</div>
+<h2 id="_runtime_features">4. Runtime features</h2>
+<div class="sectionbody">
+<h3 id="_visualizing_the_workflow_as_a_graph">4.1. Visualizing the workflow as a graph</h3><div style="clear:left"></div>
+<div class="paragraph"><p>When running a workflow, its possible to generate a provenance graph at
+the same time:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift -pgraph graph.dot first.swift
+$ dot -ograph.png -Tpng graph.dot</tt></pre>
+</div></div>
+<div class="paragraph"><p>graph.png can then be viewed using your favourite image viewer. The dot application is part of the graphViz project. More information can be found at <a href="http://www.graphviz.org">http://www.graphviz.org</a>.</p></div>
+<h3 id="_running_on_a_remote_site">4.2. Running on a remote site</h3><div style="clear:left"></div>
+<div class="paragraph"><p>As configured by default, all jobs are run locally. In the previous
+examples, we’ve invoked echo and tr executables from our SwiftScript
+program. These have been run on the local system (the same computer on
+which you ran swift). We can also make our computations run on a
+remote resource.</p></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<img src="./images/icons/warning.png" alt="Warning" />
+</td>
+<td class="content">This example is necessarily more vague than previous ones,
+because it requires access to remote resources. You should ensure that
+you can submit a job using the globus-job-run (or globusrun-ws)
+command(s).</td>
+</tr></table>
+</div>
+<div class="paragraph"><p>We do not need to modify any SwiftScript code to run on another
+resource. Instead, we must modify another catalog, the site catalog.
+This catalog provides details of the location that applications will be
+run, with the default settings referring to the local machine. We will
+modify it to refer to a remote resource - the UC Teraport cluster. If
+you are not a UC Teraport user, you should use details of a different
+resource that you do have access to.</p></div>
+<div class="paragraph"><p>The site catalog is located in etc/sites.xml and is a relatively
+straightforward XML format file. We must modify each of the following
+three settings: gridftp (which indicates how and where data can be
+transferred to the remote resource), jobmanager (which indicates how
+applications can be run on the remote resource) and workdirectory (which
+indicates where working storage can be found on the remote resource).</p></div>
+<h3 id="_writing_a_mapper">4.3. Writing a mapper</h3><div style="clear:left"></div>
+<div class="paragraph"><p>This section will introduce writing a custom mapper so that Swift is
+able to access data files laid out in application-specific ways.</p></div>
+<div class="paragraph"><p>An application-specific mapper must take the form of a Java class that
+implements the <a href="http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html">Mapper
+interface</a>.</p></div>
+<div class="paragraph"><p>Usually you don’t need to implement this interface directly, because
+Swift provides a number of more concrete classes with some functionality
+already implemented.</p></div>
+<div class="paragraph"><p>The hierarchy of helper classes is:</p></div>
+<div class="paragraph"><p><a href="http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/Mapper.html">Mapper</a></p></div>
+<div class="paragraph"><p>This is the abstract interface for mappers in Swift. You must
+implement methods to provide access to mapper properties, to map from a
+SwiftScript dataset path (such as foo[1].bar) to a file name, to check
+whether a file exists. None of the default Swift mappers implement this
+interface directly - instead they use one of the following helper classes.</p></div>
+<div class="paragraph"><p><a href="http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/AbstractMapper.html">Abstract Mapper</a></p></div>
+<div class="paragraph"><p>This provides helper methods to manage mapper properties and to handle
+existance checking. Examples of mappers which use this class are:
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.array_mapper">Array Mapper</a>,
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.csv_mapper">CSV Mapper</a>,
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.fixed_array_mapper">Fixed Array Mapper</a>,
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.regexp_mapper">Regexp Mapper</a>,
+and <a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.single_file_mapper">Single File Mapper</a>.</p></div>
+<div class="paragraph"><p><a href="http://www.ci.uchicago.edu/swift/javadoc/vdsk/org/griphyn/vdl/mapping/file/AbstractFileMapper.html">AbstractFileMapper</a>
+This provides a helper class for mappers which select files based on
+selecting files from a directory listing. It is necessary to write some
+helper methods that are different from the above mapper methods.
+Examples of mappers which use this class are:
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.simple_mapper">simple_mapper</a>,
+<a href="http://www.ci.uchicago.edu/swift/guides/userguide.php#mapper.filesys_mapper">filesys_mapper</a>,
+and the StructuredRegularExpressionMapper.</p></div>
+<div class="paragraph"><p>In general, to write a mapper, choose either the AbstractMapper or the
+AbstractFileMapper and extend those. If your mapper will generally
+select the files it returns based on a directory listing and will
+convert paths to filenames using some regular conversion (for example,
+in the way that simple_mapper maps files in a directory that match a
+particular pattern), then you should probably use the
+AbstractFileMapper. If your mapper will produce a list of files in some
+other way (for example, in the way that csv_mapper maps based on
+filenames given in a CSV file rather than looking at which files are in
+a directory), then you should probably use the AbstractMapper.</p></div>
+<h3 id="_writing_a_very_basic_mapper">4.4. Writing a very basic mapper</h3><div style="clear:left"></div>
+<div class="paragraph"><p>In this section, we will write a very basic (almost useless) mapper that
+will map a SwiftScript dataset into a hardcoded file called
+myfile.txt, like this:</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>Swift variable Filename</tt></pre>
+</div></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>var <-----------------------------> myfile.txt</tt></pre>
+</div></div>
+<div class="paragraph"><p>We should be able to use the mapper we write in a SwiftScript program
+like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type file;
+file f <my_first_mapper>;</tt></pre>
+</div></div>
+<div class="paragraph"><p>First we must choose a base class - AbstractMapper or
+AbstractFileMapper. We aren’t going to use a directory listing to decide
+on our mapping - we are getting the mapping from some other source (in
+fact, it will be hard coded). So we will use AbstractMapper.</p></div>
+<div class="paragraph"><p>So now onto the source code. We must define a subclass of AbstractMapper
+and implement several mapper methods: isStatic, existing, and map. These
+methods are documented in the javadoc for the Mapper interface.</p></div>
+<div class="paragraph"><p>Here is the code implementing this mapper. Put this in your source
+vdsk directory, make a directory src/tutorial/|and put this file in
+src/tutorial/MyFirstMapper.java.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">MyFirstMapper.java</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>package tutorial;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.Path;
+import org.griphyn.vdl.mapping.PhysicalFormat;
+
+public class MyFirstMapper extends AbstractMapper {
+
+ AbsFile myfile = new AbsFile("myfile.txt");
+
+ public boolean isStatic() {
+ return false;
+ }
+
+ public Collection existing() {
+ if (myfile.exists())
+ return Arrays.asList(new Path[] {Path.EMPTY_PATH});
+ else
+ return Collections.EMPTY_LIST;
+ }
+
+ public PhysicalFormat map(Path p) {
+ if(p.equals(Path.EMPTY_PATH))
+ return myfile;
+ else
+ return null;
+ }
+}</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Now we need to inform the Swift engine about the existence of this
+mapper. We do that by editing the MapperFactory class definition, in
+src/org/griphyn/vdl/mapping/MapperFactory.java and adding a
+registerMapper call alongside the existing registerMapper calls, like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>registerMapper("my_first_mapper", tutorial.MyFirstMapper.class);</tt></pre>
+</div></div>
+<div class="paragraph"><p>The first parameter is the name of the mapper that will be used in
+SwiftScript program. The second parameter is the new Mapper class that
+we just wrote.</p></div>
+<div class="paragraph"><p>Now rebuild Swift using the "ant redist" target.</p></div>
+<div class="paragraph"><p>This new Swift build will be aware of your new mapper. We can test it
+out with a hello world program:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">my_first_mapper.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type messagefile;
+
+app (messagefile t) greeting() {
+ echo "hello" stdout=@filename(t);
+}
+
+messagefile outfile <my_first_mapper>;
+
+outfile = greeting();</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>Run this program, and hopefully you will find the "hello" string has
+been output into the hard coded output file myfile.txt:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat myfile.txt
+hello</tt></pre>
+</div></div>
+<div class="paragraph"><p>So that’s a first very simple mapper implemented. Compare the source
+code to the single_file_mapper in
+<a href="http://www.ci.uchicago.edu/trac/swift/browser/trunk/src/org/griphyn/vdl/mapping/file/SingleFileMapper.java">SingleFileMapper.java</a>.
+There is not much more code to the single_file_mapper - mostly code to
+deal with the file parameter.</p></div>
+<h3 id="_starting_and_restarting">4.5. Starting and restarting</h3><div style="clear:left"></div>
+<div class="paragraph"><p>Now we’re going to try out the restart capabilities of Swift. We will
+make a workflow that will deliberately fail, and then we will fix the
+problem so that Swift can continue with the workflow.</p></div>
+<div class="paragraph"><p>First we have the program in working form, restart.swift.</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">restart.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type file;
+
+app (file f) touch() {
+ touch @f;
+}
+
+app (file f) processL(file inp) {
+ echo "processL" stdout=@f;
+}
+
+app (file f) processR(file inp) {
+ broken "process" stdout=@f;
+}
+
+app (file f) join(file left, file right) {
+ echo "join" @left @right stdout=@f;
+}
+
+file f = touch();
+
+file g = processL(f);
+file h = processR(f);
+
+file i = join(g,h);</tt></pre>
+</div></div>
+</div></div>
+<div class="paragraph"><p>We must define some transformation catalog entries:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>localhost touch /usr/bin/touch INSTALLED INTEL32::LINUX null
+localhost broken /bin/true INSTALLED INTEL32::LINUX null</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now we can run the program:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift restart.swift
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1119-3kgzzi15
+Progress:
+Final status: Finished successfully:4</tt></pre>
+</div></div>
+<div class="paragraph"><p>Four jobs run - touch, echo, broken and a final echo. (note that broken
+isn’t actually broken yet).</p></div>
+<div class="paragraph"><p>Now we will break the broken job and see what happens. Replace the
+definition in tc.data for broken with this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>localhost broken /bin/false INSTALLED INTEL32::LINUX null</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now when we run the workflow, the broken task fails:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1121-tssdcljg
+Progress:
+Progress: Stage in:1 Finished successfully:2
+Execution failed:
+ Exception in broken:
+Arguments: [process]
+Host: localhost
+Directory: restart-20100526-1121-tssdcljg/jobs/1/broken-1i6ufisj
+stderr.txt:
+stdout.txt:</tt></pre>
+</div></div>
+<div class="paragraph"><p>From the output we can see that touch and the first echo completed, but
+then broken failed and so swift did not attempt to execute the final echo.</p></div>
+<div class="paragraph"><p>There will be a restart log with the same name as the RunID:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ ls *20100526-1121-tssdcljg*rlog
+restart-20100526-1121-tssdcljg.0.rlog</tt></pre>
+</div></div>
+<div class="paragraph"><p>This restart log contains enough information for swift to know which
+parts of the workflow were executed successfully.</p></div>
+<div class="paragraph"><p>We can try to rerun it immediately, like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1125-7yx0zi6d
+Progress:
+Execution failed:
+ Exception in broken:
+Arguments: [process]
+Host: localhost
+Directory: restart-20100526-1125-7yx0zi6d/jobs/m/broken-msn1gisj
+stderr.txt:
+stdout.txt:
+
+Caused by:
+ Exit code 1</tt></pre>
+</div></div>
+<div class="paragraph"><p>Swift tried to resume the workflow by executing "broken" again. It did
+not try to run the touch or first echo jobs, because the restart log
+says that they do not need to be executed again.</p></div>
+<div class="paragraph"><p>Broken failed again, leaving the original restart log in place.</p></div>
+<div class="paragraph"><p>Now we will fix the problem with "broken" by restoring the original
+tc.data line that works.</p></div>
+<div class="paragraph"><p>Remove the existing "broken" line and replace it with the successful
+tc.data entry above:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>localhost broken /bin/true INSTALLED INTEL32::LINUX null</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now run again:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift -resume restart-20100526-1121-tssdcljg.0.rlog restart.swift
+
+Swift 0.9 swift-r2860 cog-r2388
+
+RunID: 20100526-1128-a2gfuxhg
+Progress:
+Final status: Initializing:2 Finished successfully:2</tt></pre>
+</div></div>
+<div class="paragraph"><p>Swift tries to run "broken" again. This time it works, and so Swift
+continues on to execute the final piece of the workflow as if nothing
+had ever gone wrong.</p></div>
+</div>
+<h2 id="_bits">5. Bits</h2>
+<div class="sectionbody">
+<h3 id="_named_and_optional_parameters">5.1. Named and optional parameters</h3><div style="clear:left"></div>
+<div class="paragraph"><p>In addition to specifying parameters positionally, parameters can be
+named, and if desired a default value can be specified:</p></div>
+<div class="sidebarblock">
+<div class="sidebar-content">
+<div class="sidebar-title">default.swift</div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>type file;
+
+// s has a default value
+app (file t) echo (string s="hello world") {
+ echo s stdout=@filename(t);
+}
+
+file hw1<"default.1.txt">;
+file hw2<"default.2.txt">;
+
+// procedure call using the default value
+hw1 = echo();
+
+// using a different value
+hw2 = echo(s="hello again");</tt></pre>
+</div></div>
+</div></div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2011-07-19 14:47:55 CDT
+</div>
+</div>
+</body>
+</html>
Deleted: trunk/docs/tutorial/tutorial.txt
===================================================================
--- trunk/docs/tutorial/tutorial.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/docs/tutorial/tutorial.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,17 +0,0 @@
-A Swift Tutorial
-================
-
-:toc:
-:icons:
-:website: http://www.ci.uchicago.edu/swift/guides/tutorial.php
-:numbered:
-
-include::introduction[]
-
-include::hello_world[]
-
-include::language_features[]
-
-include::runtime_features[]
-
-include::bits[]
Added: trunk/docs/tutorial/tutorial.txt
===================================================================
--- trunk/docs/tutorial/tutorial.txt (rev 0)
+++ trunk/docs/tutorial/tutorial.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,17 @@
+A Swift Tutorial
+================
+
+:toc:
+:icons:
+:website: http://www.ci.uchicago.edu/swift/guides/tutorial.php
+:numbered:
+
+include::introduction[]
+
+include::hello_world[]
+
+include::language_features[]
+
+include::runtime_features[]
+
+include::bits[]
Deleted: trunk/examples/anonymous.swift
===================================================================
--- trunk/examples/anonymous.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/anonymous.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,21 +0,0 @@
-type messagefile {}
-type countfile {}
-
-(messagefile t) greeting (string s) {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-(countfile t) countwords (messagefile f) {
- app {
- wc "-w" @filename(f) stdout=@filename(t);
- }
-}
-
-messagefile outfile;
-countfile c <"count14.txt">;
-
-outfile = greeting("hello from Swift");
-c = countwords(outfile);
-
Deleted: trunk/examples/array_index.swift
===================================================================
--- trunk/examples/array_index.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/array_index.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,13 +0,0 @@
-type file {}
-
-
-(file t) echo_array (string s[]) {
- app {
- echo s[0] s[1] s[2] stdout=@filename(t);
- }
-}
-
-string greetings[] = ["how","are","you"];
-file hw = echo_array(greetings);
-
-
Deleted: trunk/examples/array_wildcard.swift
===================================================================
--- trunk/examples/array_wildcard.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/array_wildcard.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,13 +0,0 @@
-type file {}
-
-
-(file t) echo_wildcard (string s[]) {
- app {
- echo s[*] stdout=@filename(t);
- }
-}
-
-string greetings[] = ["how","are","you"];
-file hw = echo_wildcard(greetings);
-
-
Deleted: trunk/examples/catsn.swift
===================================================================
--- trunk/examples/catsn.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/catsn.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,15 +0,0 @@
-type file;
-
-app (file o) cat (file i)
-{
- cat @i stdout=@o;
-}
-
-string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-string char[] = @strsplit(t, "");
-
-file out[]<simple_mapper; location=".", prefix="catsn.",suffix=".out">;
-foreach j in [1:@toint(@arg("n","10"))] {
- file data<"data.txt">;
- out[j] = cat(data);
-}
Deleted: trunk/examples/default.swift
===================================================================
--- trunk/examples/default.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/default.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,11 +0,0 @@
-type file {}
-
-(file t) echo (string s="hello world") { //s has a default value
- app {
- echo s stdout=@filename(t); //redirect stdout to a file
- }
-}
-
-file hw1, hw2;
-hw1 = echo(); // procedure call using the default value
-hw2 = echo(s="hello again"); // using a different value
Deleted: trunk/examples/first.swift
===================================================================
--- trunk/examples/first.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/first.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,10 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting() {
- echo "Hello, world!" stdout=@filename(t);
-}
-
-messagefile outfile <"hello.txt">;
-
-outfile = greeting();
-
Deleted: trunk/examples/fixedarray.swift
===================================================================
--- trunk/examples/fixedarray.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/fixedarray.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,19 +0,0 @@
-type messagefile {}
-type countfile {}
-
-(countfile t) countwords (messagefile f) {
- app {
- wc "-w" @filename(f) stdout=@filename(t);
- }
-}
-
-string inputNames = "one.txt two.txt three.txt";
-string outputNames = "one.count two.count three.count";
-
-messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
-countfile outputfiles[] <fixed_array_mapper;files=outputNames>;
-
-outputfiles[0] = countwords(inputfiles[0]);
-outputfiles[1] = countwords(inputfiles[1]);
-outputfiles[2] = countwords(inputfiles[2]);
-
Deleted: trunk/examples/foreach.swift
===================================================================
--- trunk/examples/foreach.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/foreach.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,22 +0,0 @@
-type messagefile {}
-type countfile {}
-
-(countfile t) countwords (messagefile f) {
- app {
- wc "-w" @filename(f) stdout=@filename(t);
- }
-}
-
-string inputNames = "one.txt two.txt three.txt";
-
-messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
-
-
-foreach f in inputfiles {
- countfile c<regexp_mapper;
- source=@f,
- match="(.*)txt",
- transform="\\1count">;
- c = countwords(f);
-}
-
Deleted: trunk/examples/hostsn.swift
===================================================================
--- trunk/examples/hostsn.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/hostsn.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,11 +0,0 @@
-type file;
-
-app (file o) hostname ()
-{
- hostname stdout=@o;
-}
-
-file out[]<simple_mapper; location="outdir", prefix="f.",suffix=".out">;
-foreach j in [1:@toint(@arg("n","1"))] {
- out[j] = hostname();
-}
Deleted: trunk/examples/if.swift
===================================================================
--- trunk/examples/if.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/if.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-type messagefile {}
-
-(messagefile t) greeting (string s) {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-messagefile outfile <"hello20.txt">;
-
-boolean morning = true;
-
-if(morning) {
- outfile = greeting("good morning");
-} else {
- outfile = greeting("good afternoon");
-}
-
Deleted: trunk/examples/iterate.swift
===================================================================
--- trunk/examples/iterate.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/iterate.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-type counterfile;
-
-app (counterfile t) echo(string m) {
- echo m stdout=@filename(t);
-}
-
-app (counterfile t) countstep(counterfile i) {
- wcl @filename(i) @filename(t);
-}
-
-counterfile a[] <simple_mapper;prefix="foldout">;
-
-a[0] = echo("793578934574893");
-
-iterate v {
- a[v+1] = countstep(a[v]);
- trace("extract int value ", at extractint(a[v+1]));
-} until (@extractint(a[v+1]) <= 1);
Deleted: trunk/examples/manyparam.swift
===================================================================
--- trunk/examples/manyparam.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/manyparam.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,13 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s) {
- echo s stdout=@filename(t);
-}
-
-messagefile english <"english.txt">;
-messagefile french <"francais.txt">;
-english = greeting("hello");
-french = greeting("bonjour");
-
-messagefile japanese <"nihongo.txt">;
-japanese = greeting("konnichiwa");
Added: trunk/examples/misc/array_index.swift
===================================================================
--- trunk/examples/misc/array_index.swift (rev 0)
+++ trunk/examples/misc/array_index.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,8 @@
+type file;
+
+app (file t) echo_array (string s[]) {
+ echo s[0] s[1] s[2] stdout=@filename(t);
+}
+
+string greetings[] = ["how","are","you"];
+file hw = echo_array(greetings);
Added: trunk/examples/misc/array_wildcard.swift
===================================================================
--- trunk/examples/misc/array_wildcard.swift (rev 0)
+++ trunk/examples/misc/array_wildcard.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,8 @@
+type file;
+
+app (file t) echo_wildcard (string s[]) {
+ echo s[*] stdout=@filename(t);
+}
+
+string greetings[] = ["how","are","you"];
+file hw = echo_wildcard(greetings);
Added: trunk/examples/misc/catsn.swift
===================================================================
--- trunk/examples/misc/catsn.swift (rev 0)
+++ trunk/examples/misc/catsn.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,15 @@
+type file;
+
+app (file o) cat (file i)
+{
+ cat @i stdout=@o;
+}
+
+string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+string char[] = @strsplit(t, "");
+
+file out[]<simple_mapper; location=".", prefix="catsn.",suffix=".out">;
+foreach j in [1:@toint(@arg("n","10"))] {
+ file data<"data.txt">;
+ out[j] = cat(data);
+}
Added: trunk/examples/misc/hostsn.swift
===================================================================
--- trunk/examples/misc/hostsn.swift (rev 0)
+++ trunk/examples/misc/hostsn.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,11 @@
+type file;
+
+app (file o) hostname ()
+{
+ hostname stdout=@o;
+}
+
+file out[]<simple_mapper; location="outdir", prefix="f.",suffix=".out">;
+foreach j in [1:@toint(@arg("n","1"))] {
+ out[j] = hostname();
+}
Deleted: trunk/examples/one.txt
===================================================================
--- trunk/examples/one.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/one.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-this is one.txt
Deleted: trunk/examples/parameter.swift
===================================================================
--- trunk/examples/parameter.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/parameter.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,10 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s) {
- echo s stdout=@filename(t);
-}
-
-messagefile outfile <"hello2.txt">;
-
-outfile = greeting("hello world");
-
Deleted: trunk/examples/q16.txt
===================================================================
--- trunk/examples/q16.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q16.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-foo bar
Deleted: trunk/examples/q21.swift
===================================================================
--- trunk/examples/q21.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q21.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,14 +0,0 @@
-type messagefile {}
-
-(messagefile t) greeting (string s="hello") {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-messagefile english <"english2.txt">;
-messagefile french <"francais2.txt">;
-
-english = greeting();
-french = greeting(s="bonjour");
-
Deleted: trunk/examples/q3.swift
===================================================================
--- trunk/examples/q3.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q3.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,10 +0,0 @@
-type file {}
-
-(file t) echo (string s = "default greeting") {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-file hw = echo();
-
Deleted: trunk/examples/q5.swift
===================================================================
--- trunk/examples/q5.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q5.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,12 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s[]) {
- echo s[0] s[1] s[2] stdout=@filename(t);
-}
-
-messagefile outfile <"q5out.txt">;
-
-string words[] = ["how","are","you"];
-
-outfile = greeting(words);
-
Deleted: trunk/examples/q6.swift
===================================================================
--- trunk/examples/q6.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q6.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,14 +0,0 @@
-type file {}
-
-(file t) echo (string s) {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-string greetings[] = ["how","are","you"];
-
-foreach g in greetings {
- file hw = echo(g);
-}
-
Deleted: trunk/examples/q7.swift
===================================================================
--- trunk/examples/q7.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/q7.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,16 +0,0 @@
-type file {}
-
-(file t) echo (string s) {
- app {
- echo s stdout=@filename(t);
- }
-}
-
-string outputNames = "one two three";
-
-file outputFiles[] <fixed_array_mapper;files=outputNames>;
-
-foreach f in outputFiles {
- f = echo("hello");
-}
-
Deleted: trunk/examples/regexp.swift
===================================================================
--- trunk/examples/regexp.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/regexp.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-type messagefile {}
-type countfile {}
-
-(countfile t) countwords (messagefile f) {
- app {
- wc "-w" @filename(f) stdout=@filename(t);
- }
-}
-
-messagefile inputfile <"q16.txt">;
-
-countfile c <regexp_mapper;
- source=@inputfile,
- match="(.*)txt",
- transform="\\1count">;
-
-c = countwords(inputfile);
-
Deleted: trunk/examples/restart.swift
===================================================================
--- trunk/examples/restart.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/restart.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,24 +0,0 @@
-type file;
-
-app (file f) touch() {
- touch @f;
-}
-
-app (file f) processL(file inp) {
- echo "processL" stdout=@f;
-}
-
-app (file f) processR(file inp) {
- broken "process" stdout=@f;
-}
-
-app (file f) join(file left, file right) {
- echo "join" @left @right stdout=@f;
-}
-
-file f = touch();
-
-file g = processL(f);
-file h = processR(f);
-
-file i = join(g,h);
Deleted: trunk/examples/second_procedure.swift
===================================================================
--- trunk/examples/second_procedure.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/second_procedure.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,16 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s) {
- echo s stdout=@filename(t);
-}
-
-app (messagefile o) capitalise(messagefile i) {
- tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
-}
-
-messagefile hellofile <"hello.txt">;
-messagefile final <"capitals.txt">;
-
-hellofile = greeting("hello from Swift");
-final = capitalise(hellofile);
-
Deleted: trunk/examples/three.txt
===================================================================
--- trunk/examples/three.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/three.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-three
Added: trunk/examples/tutorial/MyFirstMapper.java
===================================================================
--- trunk/examples/tutorial/MyFirstMapper.java (rev 0)
+++ trunk/examples/tutorial/MyFirstMapper.java 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,33 @@
+package tutorial;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.griphyn.vdl.mapping.AbsFile;
+import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.Path;
+import org.griphyn.vdl.mapping.PhysicalFormat;
+
+public class MyFirstMapper extends AbstractMapper {
+
+ AbsFile myfile = new AbsFile("myfile.txt");
+
+ public boolean isStatic() {
+ return false;
+ }
+
+ public Collection existing() {
+ if (myfile.exists())
+ return Arrays.asList(new Path[] {Path.EMPTY_PATH});
+ else
+ return Collections.EMPTY_LIST;
+ }
+
+ public PhysicalFormat map(Path p) {
+ if(p.equals(Path.EMPTY_PATH))
+ return myfile;
+ else
+ return null;
+ }
+}
Added: trunk/examples/tutorial/arrays.swift
===================================================================
--- trunk/examples/tutorial/arrays.swift (rev 0)
+++ trunk/examples/tutorial/arrays.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,12 @@
+type messagefile;
+
+app (messagefile t) greeting (string s[]) {
+ echo s[0] s[1] s[2] stdout=@filename(t);
+}
+
+messagefile outfile <"arrays.txt">;
+
+string words[] = ["how","are","you"];
+
+outfile = greeting(words);
+
Added: trunk/examples/tutorial/capitalise.swift
===================================================================
--- trunk/examples/tutorial/capitalise.swift (rev 0)
+++ trunk/examples/tutorial/capitalise.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,14 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}
+
+messagefile hellofile <"capitalise.1.txt">;
+messagefile final <"capitalise.2.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);
Added: trunk/examples/tutorial/capitalise_anonymous.swift
===================================================================
--- trunk/examples/tutorial/capitalise_anonymous.swift (rev 0)
+++ trunk/examples/tutorial/capitalise_anonymous.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,14 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}
+
+messagefile hellofile;
+messagefile final <"capitalise_anonymous.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);
Added: trunk/examples/tutorial/default.swift
===================================================================
--- trunk/examples/tutorial/default.swift (rev 0)
+++ trunk/examples/tutorial/default.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,15 @@
+type file;
+
+// s has a default value
+app (file t) echo (string s="hello world") {
+ echo s stdout=@filename(t);
+}
+
+file hw1<"default.1.txt">;
+file hw2<"default.2.txt">;
+
+// procedure call using the default value
+hw1 = echo();
+
+// using a different value
+hw2 = echo(s="hello again");
Added: trunk/examples/tutorial/fixed_array_mapper.1.txt
===================================================================
--- trunk/examples/tutorial/fixed_array_mapper.1.txt (rev 0)
+++ trunk/examples/tutorial/fixed_array_mapper.1.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+one
Added: trunk/examples/tutorial/fixed_array_mapper.2.txt
===================================================================
--- trunk/examples/tutorial/fixed_array_mapper.2.txt (rev 0)
+++ trunk/examples/tutorial/fixed_array_mapper.2.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+two words
Added: trunk/examples/tutorial/fixed_array_mapper.3.txt
===================================================================
--- trunk/examples/tutorial/fixed_array_mapper.3.txt (rev 0)
+++ trunk/examples/tutorial/fixed_array_mapper.3.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+three words now
Added: trunk/examples/tutorial/fixed_array_mapper.swift
===================================================================
--- trunk/examples/tutorial/fixed_array_mapper.swift (rev 0)
+++ trunk/examples/tutorial/fixed_array_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "fixed_array_mapper.1.txt fixed_array_mapper.2.txt fixed_array_mapper.3.txt";
+string outputNames = "fixed_array_mapper.1.count fixed_array_mapper.2.count fixed_array_mapper.3.count";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+countfile outputfiles[] <fixed_array_mapper;files=outputNames>;
+
+outputfiles[0] = countwords(inputfiles[0]);
+outputfiles[1] = countwords(inputfiles[1]);
+outputfiles[2] = countwords(inputfiles[2]);
Added: trunk/examples/tutorial/foreach.1.txt
===================================================================
--- trunk/examples/tutorial/foreach.1.txt (rev 0)
+++ trunk/examples/tutorial/foreach.1.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+one
Added: trunk/examples/tutorial/foreach.2.txt
===================================================================
--- trunk/examples/tutorial/foreach.2.txt (rev 0)
+++ trunk/examples/tutorial/foreach.2.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+two words
Added: trunk/examples/tutorial/foreach.3.txt
===================================================================
--- trunk/examples/tutorial/foreach.3.txt (rev 0)
+++ trunk/examples/tutorial/foreach.3.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+three words now
Added: trunk/examples/tutorial/foreach.swift
===================================================================
--- trunk/examples/tutorial/foreach.swift (rev 0)
+++ trunk/examples/tutorial/foreach.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,18 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "foreach.1.txt foreach.2.txt foreach.3.txt";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+
+foreach f in inputfiles {
+ countfile c<regexp_mapper;
+ source=@f,
+ match="(.*)txt",
+ transform="\\1count">;
+ c = countwords(f);
+}
Added: trunk/examples/tutorial/hello.swift
===================================================================
--- trunk/examples/tutorial/hello.swift (rev 0)
+++ trunk/examples/tutorial/hello.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,10 @@
+type messagefile;
+
+app (messagefile t) greeting() {
+ echo "Hello, world!" stdout=@filename(t);
+}
+
+messagefile outfile <"hello.txt">;
+
+outfile = greeting();
+
Added: trunk/examples/tutorial/if.swift
===================================================================
--- trunk/examples/tutorial/if.swift (rev 0)
+++ trunk/examples/tutorial/if.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"if.txt">;
+
+boolean morning = true;
+
+if(morning) {
+ outfile = greeting("good morning");
+} else {
+ outfile = greeting("good afternoon");
+}
+
Added: trunk/examples/tutorial/manyparam.swift
===================================================================
--- trunk/examples/tutorial/manyparam.swift (rev 0)
+++ trunk/examples/tutorial/manyparam.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,13 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile english <"manyparam.english.txt">;
+messagefile french <"manyparam.french.txt">;
+messagefile japanese <"manyparam.japanese.txt">;
+
+english = greeting("hello");
+french = greeting("bonjour");
+japanese = greeting("konnichiwa");
Added: trunk/examples/tutorial/my_first_mapper.swift
===================================================================
--- trunk/examples/tutorial/my_first_mapper.swift (rev 0)
+++ trunk/examples/tutorial/my_first_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,9 @@
+type messagefile;
+
+app (messagefile t) greeting() {
+ echo "hello" stdout=@filename(t);
+}
+
+messagefile outfile <my_first_mapper>;
+
+outfile = greeting();
Added: trunk/examples/tutorial/one.txt
===================================================================
--- trunk/examples/tutorial/one.txt (rev 0)
+++ trunk/examples/tutorial/one.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+one
Added: trunk/examples/tutorial/parameter.swift
===================================================================
--- trunk/examples/tutorial/parameter.swift (rev 0)
+++ trunk/examples/tutorial/parameter.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,8 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"parameter.hello.txt">;
+outfile = greeting("hello world");
Added: trunk/examples/tutorial/regexp_mapper.swift
===================================================================
--- trunk/examples/tutorial/regexp_mapper.swift (rev 0)
+++ trunk/examples/tutorial/regexp_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+messagefile inputfile <"regexp_mapper.words.txt">;
+
+countfile c <regexp_mapper;
+ source=@inputfile,
+ match="(.*)txt",
+ transform="\\1count">;
+
+c = countwords(inputfile);
+
Added: trunk/examples/tutorial/regexp_mapper.words.txt
===================================================================
--- trunk/examples/tutorial/regexp_mapper.words.txt (rev 0)
+++ trunk/examples/tutorial/regexp_mapper.words.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+Testing is so much fun!
Added: trunk/examples/tutorial/restart.swift
===================================================================
--- trunk/examples/tutorial/restart.swift (rev 0)
+++ trunk/examples/tutorial/restart.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,24 @@
+type file;
+
+app (file f) touch() {
+ touch @f;
+}
+
+app (file f) processL(file inp) {
+ echo "processL" stdout=@f;
+}
+
+app (file f) processR(file inp) {
+ broken "process" stdout=@f;
+}
+
+app (file f) join(file left, file right) {
+ echo "join" @left @right stdout=@f;
+}
+
+file f = touch();
+
+file g = processL(f);
+file h = processR(f);
+
+file i = join(g,h);
Added: trunk/examples/tutorial/sequential_iteration.swift
===================================================================
--- trunk/examples/tutorial/sequential_iteration.swift (rev 0)
+++ trunk/examples/tutorial/sequential_iteration.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,18 @@
+type counterfile;
+
+app (counterfile t) echo(string m) {
+ echo m stdout=@filename(t);
+}
+
+app (counterfile t) countstep(counterfile i) {
+ wcl @filename(i) @filename(t);
+}
+
+counterfile a[] <simple_mapper;prefix="sequential_iteration.foldout">;
+
+a[0] = echo("793578934574893");
+
+iterate v {
+ a[v+1] = countstep(a[v]);
+ trace("extract int value ", at extractint(a[v+1]));
+} until (@extractint(a[v+1]) <= 1);
Added: trunk/examples/tutorial/three.txt
===================================================================
--- trunk/examples/tutorial/three.txt (rev 0)
+++ trunk/examples/tutorial/three.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+three words now
Added: trunk/examples/tutorial/two.txt
===================================================================
--- trunk/examples/tutorial/two.txt (rev 0)
+++ trunk/examples/tutorial/two.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+two words
Added: trunk/examples/tutorial/types.swift
===================================================================
--- trunk/examples/tutorial/types.swift (rev 0)
+++ trunk/examples/tutorial/types.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,20 @@
+type messagefile;
+
+type details {
+ string name;
+ int pies;
+}
+
+app (messagefile t) greeting (details d) {
+ echo "Hello. Your name is" d.name "and you have eaten" d.pies "pies." stdout=@filename(t);
+}
+
+details person;
+
+person.name = "John";
+person.pies = 3;
+
+messagefile outfile <"types.pies.txt">;
+
+outfile = greeting(person);
+
Added: trunk/examples/tutorial/wcl
===================================================================
--- trunk/examples/tutorial/wcl (rev 0)
+++ trunk/examples/tutorial/wcl 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo -n $(wc -c < $1) > $2
+
Property changes on: trunk/examples/tutorial/wcl
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/examples/tutorial/words.txt
===================================================================
--- trunk/examples/tutorial/words.txt (rev 0)
+++ trunk/examples/tutorial/words.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+Hello world, this is a test
Deleted: trunk/examples/two.txt
===================================================================
--- trunk/examples/two.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/two.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-a second file
Deleted: trunk/examples/types.swift
===================================================================
--- trunk/examples/types.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/types.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,20 +0,0 @@
-type messagefile;
-
-type details {
- string name;
- int pies;
-}
-
-app (messagefile t) greeting (details d) {
- echo "Hello. Your name is" d.name "and you have eaten" d.pies "pies." stdout=@filename(t);
-}
-
-details person;
-
-person.name = "John";
-person.pies = 3;
-
-messagefile outfile <"q15.txt">;
-
-outfile = greeting(person);
-
Deleted: trunk/examples/wcl
===================================================================
--- trunk/examples/wcl 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/examples/wcl 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,3 +0,0 @@
-#!/bin/bash
-echo -n $(wc -c < $1) > $2
-
Deleted: trunk/tests/documentation/3-1_hello_world.check.sh
===================================================================
--- trunk/tests/documentation/3-1_hello_world.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/3-1_hello_world.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -x
-grep 'Hello, world!' hello.txt || exit 1
-
-exit 0
Deleted: trunk/tests/documentation/3-1_hello_world.clean.sh
===================================================================
--- trunk/tests/documentation/3-1_hello_world.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/3-1_hello_world.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 3-1_hello_world-* 3-1_hello_world.kml 3-1_hello_world.xml hello.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/3-1_hello_world.swift
===================================================================
--- trunk/tests/documentation/3-1_hello_world.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/3-1_hello_world.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,8 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting() {
- echo "Hello, world!" stdout=@filename(t);
-}
-
-messagefile outfile <"hello.txt">;
-outfile = greeting();
Deleted: trunk/tests/documentation/4-1-2_many_parameters.check.sh
===================================================================
--- trunk/tests/documentation/4-1-2_many_parameters.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1-2_many_parameters.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -x
-grep 'hello' english.txt | grep 'bonjour' francais.txt | grep 'konnichiwa' nihongo.txt || exit 1
-
-exit 0
Deleted: trunk/tests/documentation/4-1-2_many_parameters.clean.sh
===================================================================
--- trunk/tests/documentation/4-1-2_many_parameters.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1-2_many_parameters.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-1-2_many_parameters-* 4-1-2_many_parameters.kml 4-1-2_many_parameters.xml english.txt francais.txt nihongo.txt|| exit 1
-exit 0
Deleted: trunk/tests/documentation/4-1-2_many_parameters.swift
===================================================================
--- trunk/tests/documentation/4-1-2_many_parameters.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1-2_many_parameters.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,14 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s) {
- echo s stdout=@filename(t);
-}
-
-messagefile english <"english.txt">;
-messagefile french <"francais.txt">;
-english = greeting("hello");
-french = greeting("bonjour");
-
-messagefile japanese <"nihongo.txt">;
-japanese = greeting("konnichiwa");
-
Deleted: trunk/tests/documentation/4-1_parameter.check.sh
===================================================================
--- trunk/tests/documentation/4-1_parameter.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1_parameter.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-grep 'hello world' hello2.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-1_parameter.clean.sh
===================================================================
--- trunk/tests/documentation/4-1_parameter.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1_parameter.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-1_parameter-* 4-1_parameter.kml 4-1_parameter.xml hello2.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-1_parameter.swift
===================================================================
--- trunk/tests/documentation/4-1_parameter.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-1_parameter.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,9 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s) {
- echo s stdout=@filename(t);
-}
-
-messagefile outfile <"hello2.txt">;
-
-outfile = greeting("hello world");
Deleted: trunk/tests/documentation/4-2_adding_another_application.check.sh
===================================================================
--- trunk/tests/documentation/4-2_adding_another_application.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-2_adding_another_application.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -x
-grep 'hello from Swift' hello.txt | grep 'HELLO FROM SWIFT' capitals.txt || exit 1
-
-exit 0
Deleted: trunk/tests/documentation/4-2_adding_another_application.clean.sh
===================================================================
--- trunk/tests/documentation/4-2_adding_another_application.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-2_adding_another_application.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-2_adding_another_application-* 4-2_adding_another_application.kml 4-2_adding_another_application.xml hello.txt capitals.txt|| exit 1
-exit 0
Deleted: trunk/tests/documentation/4-2_adding_another_application.swift
===================================================================
--- trunk/tests/documentation/4-2_adding_another_application.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-2_adding_another_application.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,14 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting(string s) {
- echo s stdout=@filename(t);
-}
-app (messagefile o) capitalise(messagefile i) {
- tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
-}
-
-messagefile hellofile <"hello.txt">;
-messagefile final <"capitals.txt">;
-
-hellofile = greeting("hello from Swift");
-final = capitalise(hellofile);
Deleted: trunk/tests/documentation/4-4_datatypes.check.sh
===================================================================
--- trunk/tests/documentation/4-4_datatypes.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-4_datatypes.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-grep 'Hello. Your name is John and you have eaten 3 pies.' q15.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-4_datatypes.clean.sh
===================================================================
--- trunk/tests/documentation/4-4_datatypes.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-4_datatypes.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-4_datatypes-* 4-4_datatypes.kml 4-4_datatypes.xml q15.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-4_datatypes.swift
===================================================================
--- trunk/tests/documentation/4-4_datatypes.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-4_datatypes.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,19 +0,0 @@
-type messagefile;
-
-type details {
- string name;
- int pies;
-}
-
-app (messagefile t) greeting (details d) {
- echo "Hello. Your name is" d.name "and you have eaten" d.pies "pies." stdout=@filename(t);
-}
-
-details person;
-
-person.name = "John";
-person.pies = 3;
-
-messagefile outfile <"q15.txt">;
-
-outfile = greeting(person);
Deleted: trunk/tests/documentation/4-5_arrays.check.sh
===================================================================
--- trunk/tests/documentation/4-5_arrays.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-5_arrays.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-cat q5out.txt|grep 'how are you'|| exit 1
-exit 0
Deleted: trunk/tests/documentation/4-5_arrays.clean.sh
===================================================================
--- trunk/tests/documentation/4-5_arrays.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-5_arrays.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-5_arrays-* 4-5_arrays.kml 4-5_arrays.xml q5out.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-5_arrays.swift
===================================================================
--- trunk/tests/documentation/4-5_arrays.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-5_arrays.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,11 +0,0 @@
-type messagefile;
-
-app (messagefile t) greeting (string s[]) {
- echo s[0] s[1] s[2] stdout=@filename(t);
-}
-
-messagefile outfile <"q5out.txt">;
-
-string words[] = ["how","are","you"];
-
-outfile = greeting(words);
Deleted: trunk/tests/documentation/4-6-2_fixed_array_mapper.check.sh
===================================================================
--- trunk/tests/documentation/4-6-2_fixed_array_mapper.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-6-2_fixed_array_mapper.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,6 +0,0 @@
-#!/bin/bash
-set -x
-cat one.count | grep '3 one.txt' || exit 1
-cat two.count | grep '3 two.txt' || exit 1
-cat three.count | grep '1 three.txt' || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-6-2_fixed_array_mapper.clean.sh
===================================================================
--- trunk/tests/documentation/4-6-2_fixed_array_mapper.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-6-2_fixed_array_mapper.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-6-2_fixed_array_mapper-* 4-6-2_fixed_array_mapper.kml 4-6-2_fixed_array_mapper.xml one.count two.count three.count || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-6-2_fixed_array_mapper.setup.sh
===================================================================
--- trunk/tests/documentation/4-6-2_fixed_array_mapper.setup.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-6-2_fixed_array_mapper.setup.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-cp -v $GROUP/one.txt $GROUP/two.txt $GROUP/three.txt .|| exit 1
-exit 0
Deleted: trunk/tests/documentation/4-6-2_fixed_array_mapper.swift
===================================================================
--- trunk/tests/documentation/4-6-2_fixed_array_mapper.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-6-2_fixed_array_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,16 +0,0 @@
-type messagefile {}
-type countfile {}
-
-app (countfile t) countwords (messagefile f) {
- wc "-w" @filename(f) stdout=@filename(t);
-}
-
-string inputNames = "one.txt two.txt three.txt";
-string outputNames = "one.count two.count three.count";
-
-messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
-countfile outputfiles[] <fixed_array_mapper;files=outputNames>;
-
-outputfiles[0] = countwords(inputfiles[0]);
-outputfiles[1] = countwords(inputfiles[1]);
-outputfiles[2] = countwords(inputfiles[2]);
Deleted: trunk/tests/documentation/4-7_foreach.check.sh
===================================================================
--- trunk/tests/documentation/4-7_foreach.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-7_foreach.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,6 +0,0 @@
-#!/bin/bash
-set -x
-cat one.count | grep '3 one.txt' || exit 1
-cat two.count | grep '3 two.txt' || exit 1
-cat three.count | grep '1 three.txt' || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-7_foreach.clean.sh
===================================================================
--- trunk/tests/documentation/4-7_foreach.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-7_foreach.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-7_foreach-* 4-7_foreach.kml 4-7_foreach.xml one.txt two.txt three.txt || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-7_foreach.swift
===================================================================
--- trunk/tests/documentation/4-7_foreach.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-7_foreach.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-type messagefile {}
-type countfile {}
-
-app (countfile t) countwords (messagefile f) {
- wc "-w" @filename(f) stdout=@filename(t);
-}
-
-string inputNames = "one.txt two.txt three.txt";
-
-messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
-
-foreach f in inputfiles {
- countfile c<regexp_mapper;
- source=@f,
- match="(.*)txt",
- transform="\\1count">;
- c = countwords(f);
-}
Deleted: trunk/tests/documentation/4-9_sequential_iteration.check.sh
===================================================================
Deleted: trunk/tests/documentation/4-9_sequential_iteration.clean.sh
===================================================================
--- trunk/tests/documentation/4-9_sequential_iteration.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-9_sequential_iteration.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 4-9_sequential_iteration-* 4-9_sequential_iteration.kml 4-9_sequential_iteration.xml foldout* || exit 1
-exit 0
Deleted: trunk/tests/documentation/4-9_sequential_iteration.swift
===================================================================
--- trunk/tests/documentation/4-9_sequential_iteration.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/4-9_sequential_iteration.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,18 +0,0 @@
-type counterfile;
-
-app (counterfile t) echo(string m) {
- echo m stdout=@filename(t);
-}
-
-app (counterfile t) countstep(counterfile i) {
- wcl @filename(i) @filename(t);
-}
-
-counterfile a[] <simple_mapper;prefix="foldout">;
-
-a[0] = echo("793578934574893");
-
-iterate v {
- a[v+1] = countstep(a[v]);
- trace("extract int value ", at extractint(a[v+1]));
-} until (@extractint(a[v+1]) <= 1);
Deleted: trunk/tests/documentation/6-1_named_and_optional_params.check.sh
===================================================================
--- trunk/tests/documentation/6-1_named_and_optional_params.check.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/6-1_named_and_optional_params.check.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,5 +0,0 @@
-#!/bin/bash
-set -x
-grep 'hello' english.txt | grep 'bonjour' french.txt || exit 1
-
-exit 0
Deleted: trunk/tests/documentation/6-1_named_and_optional_params.clean.sh
===================================================================
--- trunk/tests/documentation/6-1_named_and_optional_params.clean.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/6-1_named_and_optional_params.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -x
-rm -rf 6-1_named_and_optional_params-* 6-1_named_and_optional_params.kml 6-1_named_and_optional_params.xml english.txt francais.txt|| exit 1
-exit 0
Deleted: trunk/tests/documentation/6-1_named_and_optional_params.swift
===================================================================
--- trunk/tests/documentation/6-1_named_and_optional_params.swift 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/6-1_named_and_optional_params.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,9 +0,0 @@
-type messagefile;
-app (messagefile t) greeting (string s="hello") {
- echo s stdout=@filename(t);
-}
-messagefile french <"french.txt">;
-messagefile english <"english.txt">;
-
-french = greeting(s="bonjour");
-english = greeting();
Deleted: trunk/tests/documentation/one.txt
===================================================================
--- trunk/tests/documentation/one.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/one.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-this is one.txt
Deleted: trunk/tests/documentation/sites.template.xml
===================================================================
--- trunk/tests/documentation/sites.template.xml 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/sites.template.xml 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,15 +0,0 @@
-<config>
- <pool handle="localhost">
- <filesystem provider="local" />
- <execution provider="coaster" jobmanager="local:local"/>
- <profile namespace="globus" key="internalHostname">127.0.0.1</profile>
- <profile namespace="karajan" key="jobthrottle">1000</profile>
- <profile namespace="karajan" key="initialScore">10000</profile>
- <profile namespace="globus" key="jobsPerNode">4</profile>
- <profile namespace="globus" key="slots">8</profile>
- <profile namespace="globus" key="maxTime">1000</profile>
- <profile namespace="globus" key="nodeGranularity">1</profile>
- <profile namespace="globus" key="maxNodes">4</profile>
- <workdirectory>/tmp</workdirectory>
- </pool>
-</config>
Deleted: trunk/tests/documentation/swift.properties
===================================================================
--- trunk/tests/documentation/swift.properties 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/swift.properties 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,7 +0,0 @@
-wrapperlog.always.transfer=true
-sitedir.keep=true
-execution.retries=0
-lazy.errors=false
-status.mode=provider
-use.provider.staging=false
-provider.staging.pin.swiftfiles=false
Deleted: trunk/tests/documentation/tc.data
===================================================================
--- trunk/tests/documentation/tc.data 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/tc.data 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,24 +0,0 @@
-#This is the transformation catalog.
-#
-#It comes pre-configured with a number of simple transformations with
-#paths that are likely to work on a linux box. However, on some systems,
-#the paths to these executables will be different (for example, sometimes
-#some of these programs are found in /usr/bin rather than in /bin)
-#
-#NOTE WELL: fields in this file must be separated by tabs, not spaces; and
-#there must be no trailing whitespace at the end of each line.
-#
-# sitename transformation path INSTALLED platform profiles
-localhost echo /bin/echo INSTALLED INTEL32::LINUX null
-localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null
-localhost cat /bin/cat INSTALLED INTEL32::LINUX null
-localhost ls /bin/ls INSTALLED INTEL32::LINUX null
-localhost grep /bin/grep INSTALLED INTEL32::LINUX null
-localhost sort /bin/sort INSTALLED INTEL32::LINUX null
-localhost paste /bin/paste INSTALLED INTEL32::LINUX null
-localhost cp /bin/cp INSTALLED INTEL32::LINUX null
-localhost wc /usr/bin/wc INSTALLED INTEL32::LINUX null
-localhost touch /bin/touch INSTALLED INTEL32::LINUX null
-localhost sleep /bin/sleep INSTALLED INTEL32::LINUX null
-localhost delayedcat /home/Alberto/Swift/cog/modules/swift/tests/language-behaviour/delayedcat.sh INSTALLED INTEL32::LINUX null
-#localhost wcl /home/Alberto/My\ Shell\ Scripts/wcl.sh INSTALLED INTEL32::LINUX null
Deleted: trunk/tests/documentation/tc.template.data
===================================================================
--- trunk/tests/documentation/tc.template.data 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/tc.template.data 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1,24 +0,0 @@
-#This is the transformation catalog.
-#
-#It comes pre-configured with a number of simple transformations with
-#paths that are likely to work on a linux box. However, on some systems,
-#the paths to these executables will be different (for example, sometimes
-#some of these programs are found in /usr/bin rather than in /bin)
-#
-#NOTE WELL: fields in this file must be separated by tabs, not spaces; and
-#there must be no trailing whitespace at the end of each line.
-#
-# sitename transformation path INSTALLED platform profiles
-localhost echo /bin/echo INSTALLED INTEL32::LINUX null
-localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null
-localhost cat /bin/cat INSTALLED INTEL32::LINUX null
-localhost ls /bin/ls INSTALLED INTEL32::LINUX null
-localhost grep /bin/grep INSTALLED INTEL32::LINUX null
-localhost sort /bin/sort INSTALLED INTEL32::LINUX null
-localhost paste /bin/paste INSTALLED INTEL32::LINUX null
-localhost cp /bin/cp INSTALLED INTEL32::LINUX null
-localhost wc /usr/bin/wc INSTALLED INTEL32::LINUX null
-localhost touch /bin/touch INSTALLED INTEL32::LINUX null
-localhost sleep /bin/sleep INSTALLED INTEL32::LINUX null
-localhost delayedcat /home/Alberto/Swift/cog/modules/swift/tests/language-behaviour/delayedcat.sh INSTALLED INTEL32::LINUX null
-localhost wcl /usr/bin/wcl.sh INSTALLED INTEL32::LINUX null
Deleted: trunk/tests/documentation/three.txt
===================================================================
--- trunk/tests/documentation/three.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/three.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-three
Deleted: trunk/tests/documentation/title.txt
===================================================================
--- trunk/tests/documentation/title.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/title.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-Documentation Files Test
Added: trunk/tests/documentation/tutorial/arrays.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/arrays.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/arrays.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf arrays-* arrays.kml arrays.xml arrays.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/arrays.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/arrays.swift
===================================================================
--- trunk/tests/documentation/tutorial/arrays.swift (rev 0)
+++ trunk/tests/documentation/tutorial/arrays.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,12 @@
+type messagefile;
+
+app (messagefile t) greeting (string s[]) {
+ echo s[0] s[1] s[2] stdout=@filename(t);
+}
+
+messagefile outfile <"arrays.txt">;
+
+string words[] = ["how","are","you"];
+
+outfile = greeting(words);
+
Added: trunk/tests/documentation/tutorial/arrays.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/arrays.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/arrays.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+how are you
Added: trunk/tests/documentation/tutorial/capitalise.1.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/capitalise.1.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise.1.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello from Swift
Added: trunk/tests/documentation/tutorial/capitalise.2.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/capitalise.2.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise.2.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+HELLO FROM SWIFT
Added: trunk/tests/documentation/tutorial/capitalise.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/capitalise.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf capitalise-* capitalise.kml capitalise.xml hello.txt capitals.txt|| exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/capitalise.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/capitalise.swift
===================================================================
--- trunk/tests/documentation/tutorial/capitalise.swift (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,14 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}
+
+messagefile hellofile <"capitalise.1.txt">;
+messagefile final <"capitalise.2.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);
Added: trunk/tests/documentation/tutorial/capitalise_anonymous.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/capitalise_anonymous.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise_anonymous.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf capitalise-* capitalise.kml capitalise.xml hello.txt capitals.txt|| exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/capitalise_anonymous.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/capitalise_anonymous.swift
===================================================================
--- trunk/tests/documentation/tutorial/capitalise_anonymous.swift (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise_anonymous.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,14 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+app (messagefile o) capitalise(messagefile i) {
+ tr "[a-z]" "[A-Z]" stdin=@filename(i) stdout=@filename(o);
+}
+
+messagefile hellofile;
+messagefile final <"capitalise_anonymous.txt">;
+hellofile = greeting("hello from Swift");
+final = capitalise(hellofile);
Added: trunk/tests/documentation/tutorial/capitalise_anonymous.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/capitalise_anonymous.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/capitalise_anonymous.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+HELLO FROM SWIFT
Added: trunk/tests/documentation/tutorial/default.1.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/default.1.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/default.1.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello world
Added: trunk/tests/documentation/tutorial/default.2.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/default.2.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/default.2.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello again
Added: trunk/tests/documentation/tutorial/default.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/default.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/default.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf default-* default.kml default.xml hw1.txt hw2.txt hw1.txt hw2.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/default.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/default.swift
===================================================================
--- trunk/tests/documentation/tutorial/default.swift (rev 0)
+++ trunk/tests/documentation/tutorial/default.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,15 @@
+type file;
+
+// s has a default value
+app (file t) echo (string s="hello world") {
+ echo s stdout=@filename(t);
+}
+
+file hw1<"default.1.txt">;
+file hw2<"default.2.txt">;
+
+// procedure call using the default value
+hw1 = echo();
+
+// using a different value
+hw2 = echo(s="hello again");
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.1.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.1.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.1.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+1 fixed_array_mapper.1.txt
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.2.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.2.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.2.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+2 fixed_array_mapper.2.txt
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.3.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.3.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.3.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+3 fixed_array_mapper.3.txt
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf fixed_array_mapper-* fixed_array_mapper.kml fixed_array_mapper.xml one.count two.count three.count one.txt two.txt three.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/fixed_array_mapper.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.setup.sh
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.setup.sh (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.setup.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -x
+echo one > fixed_array_mapper.1.txt
+echo two words > fixed_array_mapper.2.txt
+echo three words now > fixed_array_mapper.3.txt
+exit 0
Property changes on: trunk/tests/documentation/tutorial/fixed_array_mapper.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/fixed_array_mapper.swift
===================================================================
--- trunk/tests/documentation/tutorial/fixed_array_mapper.swift (rev 0)
+++ trunk/tests/documentation/tutorial/fixed_array_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "fixed_array_mapper.1.txt fixed_array_mapper.2.txt fixed_array_mapper.3.txt";
+string outputNames = "fixed_array_mapper.1.count fixed_array_mapper.2.count fixed_array_mapper.3.count";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+countfile outputfiles[] <fixed_array_mapper;files=outputNames>;
+
+outputfiles[0] = countwords(inputfiles[0]);
+outputfiles[1] = countwords(inputfiles[1]);
+outputfiles[2] = countwords(inputfiles[2]);
Added: trunk/tests/documentation/tutorial/foreach.1.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/foreach.1.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.1.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+1 foreach.1.txt
Added: trunk/tests/documentation/tutorial/foreach.2.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/foreach.2.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.2.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+2 foreach.2.txt
Added: trunk/tests/documentation/tutorial/foreach.3.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/foreach.3.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.3.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+3 foreach.3.txt
Added: trunk/tests/documentation/tutorial/foreach.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/foreach.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf foreach-* foreach.kml foreach.xml one.txt two.txt three.txt one.count two.count three.count || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/foreach.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/foreach.setup.sh
===================================================================
--- trunk/tests/documentation/tutorial/foreach.setup.sh (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.setup.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -x
+echo one > foreach.1.txt
+echo two words > foreach.2.txt
+echo three words now > foreach.3.txt
+exit 0
Property changes on: trunk/tests/documentation/tutorial/foreach.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/foreach.swift
===================================================================
--- trunk/tests/documentation/tutorial/foreach.swift (rev 0)
+++ trunk/tests/documentation/tutorial/foreach.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,18 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+string inputNames = "foreach.1.txt foreach.2.txt foreach.3.txt";
+
+messagefile inputfiles[] <fixed_array_mapper;files=inputNames>;
+
+foreach f in inputfiles {
+ countfile c<regexp_mapper;
+ source=@f,
+ match="(.*)txt",
+ transform="\\1count">;
+ c = countwords(f);
+}
Added: trunk/tests/documentation/tutorial/hello.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/hello.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/hello.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf hello-* parameter.kml parameter.xml hello.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/hello.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/hello.swift
===================================================================
--- trunk/tests/documentation/tutorial/hello.swift (rev 0)
+++ trunk/tests/documentation/tutorial/hello.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,10 @@
+type messagefile;
+
+app (messagefile t) greeting() {
+ echo "Hello, world!" stdout=@filename(t);
+}
+
+messagefile outfile <"hello.txt">;
+
+outfile = greeting();
+
Added: trunk/tests/documentation/tutorial/hello.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/hello.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/hello.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+Hello, world!
Added: trunk/tests/documentation/tutorial/hello2.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/hello2.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/hello2.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello world
Added: trunk/tests/documentation/tutorial/if.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/if.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/if.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf if-* if.kml if.xml if.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/if.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/if.swift
===================================================================
--- trunk/tests/documentation/tutorial/if.swift (rev 0)
+++ trunk/tests/documentation/tutorial/if.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"if.txt">;
+
+boolean morning = true;
+
+if(morning) {
+ outfile = greeting("good morning");
+} else {
+ outfile = greeting("good afternoon");
+}
+
Added: trunk/tests/documentation/tutorial/if.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/if.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/if.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+good morning
Added: trunk/tests/documentation/tutorial/manyparam.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/manyparam.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/manyparam.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf manyparam-* manyparam.kml manyparam.xml english.txt francais.txt nihongo.txt|| exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/manyparam.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/manyparam.english.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/manyparam.english.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/manyparam.english.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello
Added: trunk/tests/documentation/tutorial/manyparam.french.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/manyparam.french.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/manyparam.french.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+bonjour
Added: trunk/tests/documentation/tutorial/manyparam.japanese.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/manyparam.japanese.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/manyparam.japanese.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+konnichiwa
Added: trunk/tests/documentation/tutorial/manyparam.swift
===================================================================
--- trunk/tests/documentation/tutorial/manyparam.swift (rev 0)
+++ trunk/tests/documentation/tutorial/manyparam.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,13 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile english <"manyparam.english.txt">;
+messagefile french <"manyparam.french.txt">;
+messagefile japanese <"manyparam.japanese.txt">;
+
+english = greeting("hello");
+french = greeting("bonjour");
+japanese = greeting("konnichiwa");
Added: trunk/tests/documentation/tutorial/parameter.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/parameter.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/parameter.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf parameter-* parameter.kml parameter.xml hello2.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/parameter.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/parameter.hello.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/parameter.hello.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/parameter.hello.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+hello world
Added: trunk/tests/documentation/tutorial/parameter.swift
===================================================================
--- trunk/tests/documentation/tutorial/parameter.swift (rev 0)
+++ trunk/tests/documentation/tutorial/parameter.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,8 @@
+type messagefile;
+
+app (messagefile t) greeting (string s) {
+ echo s stdout=@filename(t);
+}
+
+messagefile outfile <"parameter.hello.txt">;
+outfile = greeting("hello world");
Added: trunk/tests/documentation/tutorial/regexp_mapper.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/regexp_mapper.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/regexp_mapper.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf regexp-* regexp.kml regexp.xml words.txt words.count || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/regexp_mapper.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/regexp_mapper.setup.sh
===================================================================
--- trunk/tests/documentation/tutorial/regexp_mapper.setup.sh (rev 0)
+++ trunk/tests/documentation/tutorial/regexp_mapper.setup.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+echo 'Testing is so much fun!' > regexp_mapper.words.txt
+
Property changes on: trunk/tests/documentation/tutorial/regexp_mapper.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/regexp_mapper.swift
===================================================================
--- trunk/tests/documentation/tutorial/regexp_mapper.swift (rev 0)
+++ trunk/tests/documentation/tutorial/regexp_mapper.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,16 @@
+type messagefile;
+type countfile;
+
+app (countfile t) countwords (messagefile f) {
+ wc "-w" @filename(f) stdout=@filename(t);
+}
+
+messagefile inputfile <"regexp_mapper.words.txt">;
+
+countfile c <regexp_mapper;
+ source=@inputfile,
+ match="(.*)txt",
+ transform="\\1count">;
+
+c = countwords(inputfile);
+
Added: trunk/tests/documentation/tutorial/regexp_mapper.words.count.expected
===================================================================
--- trunk/tests/documentation/tutorial/regexp_mapper.words.count.expected (rev 0)
+++ trunk/tests/documentation/tutorial/regexp_mapper.words.count.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+5 regexp_mapper.words.txt
Added: trunk/tests/documentation/tutorial/sequential_iteration.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf sequential_iteration-* sequential_iteration.kml sequential_iteration.xml foldout* || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/sequential_iteration.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/sequential_iteration.foldout0000.expected
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.foldout0000.expected (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.foldout0000.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+793578934574893
Added: trunk/tests/documentation/tutorial/sequential_iteration.foldout0001.expected
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.foldout0001.expected (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.foldout0001.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+16
\ No newline at end of file
Added: trunk/tests/documentation/tutorial/sequential_iteration.foldout0002.expected
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.foldout0002.expected (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.foldout0002.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+2
\ No newline at end of file
Added: trunk/tests/documentation/tutorial/sequential_iteration.foldout0003.expected
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.foldout0003.expected (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.foldout0003.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+1
\ No newline at end of file
Added: trunk/tests/documentation/tutorial/sequential_iteration.setup.sh
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.setup.sh (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.setup.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,3 @@
+#!/bin/bash
+echo 'echo -n $(wc -c < $1) > $2' > /tmp/wcl
+chmod +x /tmp/wcl
Property changes on: trunk/tests/documentation/tutorial/sequential_iteration.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/sequential_iteration.swift
===================================================================
--- trunk/tests/documentation/tutorial/sequential_iteration.swift (rev 0)
+++ trunk/tests/documentation/tutorial/sequential_iteration.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,18 @@
+type counterfile;
+
+app (counterfile t) echo(string m) {
+ echo m stdout=@filename(t);
+}
+
+app (counterfile t) countstep(counterfile i) {
+ wcl @filename(i) @filename(t);
+}
+
+counterfile a[] <simple_mapper;prefix="sequential_iteration.foldout">;
+
+a[0] = echo("793578934574893");
+
+iterate v {
+ a[v+1] = countstep(a[v]);
+ trace("extract int value ", at extractint(a[v+1]));
+} until (@extractint(a[v+1]) <= 1);
Added: trunk/tests/documentation/tutorial/swift.properties
===================================================================
--- trunk/tests/documentation/tutorial/swift.properties (rev 0)
+++ trunk/tests/documentation/tutorial/swift.properties 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,7 @@
+wrapperlog.always.transfer=true
+sitedir.keep=true
+execution.retries=0
+lazy.errors=false
+status.mode=provider
+use.provider.staging=false
+provider.staging.pin.swiftfiles=false
Added: trunk/tests/documentation/tutorial/tc.template.data
===================================================================
--- trunk/tests/documentation/tutorial/tc.template.data (rev 0)
+++ trunk/tests/documentation/tutorial/tc.template.data 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,23 @@
+#This is the transformation catalog.
+#
+#It comes pre-configured with a number of simple transformations with
+#paths that are likely to work on a linux box. However, on some systems,
+#the paths to these executables will be different (for example, sometimes
+#some of these programs are found in /usr/bin rather than in /bin)
+#
+#NOTE WELL: fields in this file must be separated by tabs, not spaces; and
+#there must be no trailing whitespace at the end of each line.
+#
+# sitename transformation path INSTALLED platform profiles
+localhost echo /bin/echo INSTALLED INTEL32::LINUX null
+localhost tr /usr/bin/tr INSTALLED INTEL32::LINUX null
+localhost cat /bin/cat INSTALLED INTEL32::LINUX null
+localhost ls /bin/ls INSTALLED INTEL32::LINUX null
+localhost grep /bin/grep INSTALLED INTEL32::LINUX null
+localhost sort /bin/sort INSTALLED INTEL32::LINUX null
+localhost paste /bin/paste INSTALLED INTEL32::LINUX null
+localhost cp /bin/cp INSTALLED INTEL32::LINUX null
+localhost wc /usr/bin/wc INSTALLED INTEL32::LINUX null
+localhost touch /bin/touch INSTALLED INTEL32::LINUX null
+localhost sleep /bin/sleep INSTALLED INTEL32::LINUX null
+localhost wcl /tmp/wcl INSTALLED INTEL32::LINUX null
Added: trunk/tests/documentation/tutorial/title.txt
===================================================================
--- trunk/tests/documentation/tutorial/title.txt (rev 0)
+++ trunk/tests/documentation/tutorial/title.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+Tutorial Scripts
Added: trunk/tests/documentation/tutorial/types.clean.sh
===================================================================
--- trunk/tests/documentation/tutorial/types.clean.sh (rev 0)
+++ trunk/tests/documentation/tutorial/types.clean.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,4 @@
+#!/bin/bash
+set -x
+rm -rf types-* types.kml types.xml pies.txt || exit 1
+exit 0
Property changes on: trunk/tests/documentation/tutorial/types.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/documentation/tutorial/types.pies.txt.expected
===================================================================
--- trunk/tests/documentation/tutorial/types.pies.txt.expected (rev 0)
+++ trunk/tests/documentation/tutorial/types.pies.txt.expected 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1 @@
+Hello. Your name is John and you have eaten 3 pies.
Added: trunk/tests/documentation/tutorial/types.swift
===================================================================
--- trunk/tests/documentation/tutorial/types.swift (rev 0)
+++ trunk/tests/documentation/tutorial/types.swift 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,20 @@
+type messagefile;
+
+type details {
+ string name;
+ int pies;
+}
+
+app (messagefile t) greeting (details d) {
+ echo "Hello. Your name is" d.name "and you have eaten" d.pies "pies." stdout=@filename(t);
+}
+
+details person;
+
+person.name = "John";
+person.pies = 3;
+
+messagefile outfile <"types.pies.txt">;
+
+outfile = greeting(person);
+
Deleted: trunk/tests/documentation/two.txt
===================================================================
--- trunk/tests/documentation/two.txt 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/documentation/two.txt 2011-07-19 20:23:41 UTC (rev 4831)
@@ -1 +0,0 @@
-a second file
Modified: trunk/tests/groups/group-all-local.sh
===================================================================
--- trunk/tests/groups/group-all-local.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/groups/group-all-local.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -9,10 +9,10 @@
# $TESTDIR/cdm/star
$TESTDIR/language-behaviour/arrays \
$TESTDIR/language-behaviour/broken \
- $TESTDIR/language-behaviour/compounds \
+ $TESTDIR/language-behaviour/compounds \
$TESTDIR/language-behaviour/control_structures \
$TESTDIR/language-behaviour/IO \
- $TESTDIR/language-behaviour/datatypes \
+ $TESTDIR/language-behaviour/iterators \
$TESTDIR/language-behaviour/logic \
$TESTDIR/language-behaviour/mappers \
$TESTDIR/language-behaviour/math \
@@ -20,8 +20,7 @@
$TESTDIR/language-behaviour/procedures \
$TESTDIR/language-behaviour/strings \
$TESTDIR/language-behaviour/variables \
- $TESTDIR/language-behaviour/cleanup \
- # $TESTDIR/documentation/ \
+ $TESTDIR/documentation/tutorial \
# $TESTDIR/cdm/ps/pinned
# $TESTDIR/site/intrepid
)
Added: trunk/tests/groups/group-documentation.sh
===================================================================
--- trunk/tests/groups/group-documentation.sh (rev 0)
+++ trunk/tests/groups/group-documentation.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -0,0 +1,8 @@
+
+# GROUPLIST definition to run all local tests
+
+GROUPLIST=(
+ $TESTDIR/documentation/tutorial
+ )
+
+checkvars WORK
Modified: trunk/tests/suite.sh
===================================================================
--- trunk/tests/suite.sh 2011-07-19 18:18:40 UTC (rev 4830)
+++ trunk/tests/suite.sh 2011-07-19 20:23:41 UTC (rev 4831)
@@ -38,6 +38,9 @@
TOPDIR=`readlink -f $PWD/../../../..`
CRTDIR=`pwd`
+# Disable usage stats in test suite
+export SWIFT_USAGE_STATS=0
+
while [ $# -gt 0 ]; do
case $1 in
-a)
@@ -764,7 +767,10 @@
diff $BNE $EXPECTED 2>&1 >> $OUTPUT
if [ "$?" != "0" ]; then
RESULT="Failed"
- fi
+ echo Failed
+ else
+ echo OK
+ fi
if [ "$RESULT" == "None" ]; then
RESULT="Passed"
fi
@@ -814,7 +820,7 @@
grep THIS-SCRIPT-SHOULD-FAIL $SWIFTSCRIPT > /dev/null
TEST_SHOULD_FAIL=$(( ! $? ))
- monitored_exec $TIMEOUT swift \
+ monitored_exec $TIMEOUT swift \
-wrapperlog.always.transfer true \
-sitedir.keep true \
-config swift.properties \
@@ -824,7 +830,7 @@
TEST_SHOULD_FAIL=0
if [ -x $GROUP/$CHECKSCRIPT ]; then
- export TEST_LOG
+ export OUTPUT
script_exec $GROUP/$CHECKSCRIPT "√"
else
check_outputs $GROUP $NAME
More information about the Swift-commit
mailing list