Rinus Plasmeijer – Jan Martin Jansen - Peter Achten – Pieter Koopman University of Nijmegen - Dutch Defense Academy clean.cs.ru.nlhttp://www.cs.ru.nl/~rinus/iTaskIntro.html.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

The World Wide Web. 2 The Web is an infrastructure of distributed information combined with software that uses networks as a vehicle to exchange that.
Programming Paradigms and languages
Java Script Session1 INTRODUCTION.
Binary Trees CSC 220. Your Observations (so far data structures) Array –Unordered Add, delete, search –Ordered Linked List –??
By Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel, and Giovanni Vigna Network and Distributed System Security(NDSS ‘07)
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
FP-dag Pimp my workflow system A tool preview of iTasks 2.0 Bas Lijnse.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
VBA Modules, Functions, Variables, and Constants
The Internet Useful Definitions and Concepts About the Internet.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
IFL2002 Madrid 1 a generic test-system Pieter Koopman, Artem Alimarine, Jan Tretmans, Rinus Plasmeijer Nijmegen, NL.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Fundamentals of Python: From First Programs Through Data Structures
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
Research on cloud computing application in the peer-to-peer based video-on-demand systems Speaker : 吳靖緯 MA0G rd International Workshop.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
16-1 The World Wide Web The Web An infrastructure of distributed information combined with software that uses networks as a vehicle to exchange that information.
CPS120: Introduction to Computer Science The World Wide Web Nell Dale John Lewis.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
CIS Computer Programming Logic
Developing Workflows with SharePoint Designer David Coe Application Development Consultant Microsoft Corporation.
1 CMPT 275 High Level Design Phase Architecture. Janice Regan, Objectives of Design  The design phase takes the results of the requirements analysis.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
J2EE Structure & Definitions Catie Welsh CSE 432
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Ajax and Client-Side Evaluation of i-Tasks Workflow Specifications Rinus Plasmeijer – Jan Martin Jansen - Peter Achten – Pieter Koopman University of Nijmegen.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Oracle Data Integrator Procedures, Advanced Workflows.
Optimization in XSLT and XQuery Michael Kay. 2 Challenges XSLT/XQuery are high-level declarative languages: performance depends on good optimization Performance.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
I Power Higher Computing Software Development Development Languages and Environments.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Threads. Readings r Silberschatz et al : Chapter 4.
1 Structure of Compilers Lexical Analyzer (scanner) Modified Source Program Parser Tokens Semantic Analysis Syntactic Structure Optimizer Code Generator.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Applications Active Web Documents Active Web Documents.
Studio modeling basics
Managing State Chapter 13.
Processes and threads.
Threads vs. Events SEDA – An Event Model 5204 – Operating Systems.
PHP Training at GoLogica in Bangalore
Chap. 6 :: Control Flow Michael L. Scott.
Distributed Systems - Comp 655
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
Chap. 6 :: Control Flow Michael L. Scott.
Combining Compile-Time and Run-Time Components
Lecture 1 Runtime environments.
Chapter 4: Threads.
Presentation transcript:

Rinus Plasmeijer – Jan Martin Jansen - Peter Achten – Pieter Koopman University of Nijmegen - Dutch Defense Academy clean.cs.ru.nlhttp://

2  Overview of the i-Tasks Workflow System  i-Tasks are presented on FP-dag 2007, ICFP 2007, IFL 2007, to appear JFP 2008  Implementation of i-Tasks  Basic implementation: Task Tree Reconstruction  Optimized: Task Tree Rewriting  Two new workflow annotations influencing what is evaluated where  Local Task Rewriting on Server  using "Ajax" technology  Distributed Local Task Rewriting on Server and Clients  using "Ajax" technology and the SAPL interpreter  Conclusions

3 About Work Flow Systems  A Workflow describes the operational aspects of a work procedure  Which tasks ? Which Order ? How do they depend on each other ? Who will do what ?  A Workflow System co-ordinates the execution of a Workflow  About 25 “Workflow Patterns” identified in >30 commercial systems (Van der Aalst et al.)  sequencing, repetition, exclusive choice, multiple choice, splitting/merging (parallel or, parallel and),...  Common Characteristics commercial systems:  Nice graphical tools for the specification of workflows: flow graphs  Workflows are static  Workflows are un-typed  Limited means for abstraction  Communication between tasks via side-effects using relational databases  Semantics based on (simple) Petri Nets

4 i –Tasks Workflow System for the Web  “Demand Driven Workflows” Dutch Applied Science (STW) project  Goal: declarative “lazy” workflow system, use techniques from Haskell and Clean  i-Tasks is a first "simple" non-lazy attempt  Characteristics i-Tasks system:  Textual specification in Clean: yet another combinator library  Offer all "standard" Workflow Patterns as combinators +  Additional set of useful workflow patterns  Higher order tasks, exceptions  Workflows are dynamically constructed, can depend on the results of tasks  Strongly typed  Powerful means for abstractions, composition, re-usability  Use standard Web Browsers  Making good use of our existing i-Data library for handling web forms  Amazingly simple, combinator based, executable workflow specification  Do as much as possible automatically using generic programming techniques  i-Task application remembers its state of evaluation !!!!!!!!!!!

5 A very small yet *complete* example module example import StdEnv, iTasks Start world = doHtmlServer (singleUserTask [ ] example) world example example :: Task Int example = editTask "Done" createDefault

6 A very small yet *complete* example module example import StdEnv, iTasks Start world = doHtmlServer (singleUserTask [ ] example) world exampleexample :: Task Person example = editTask "Done" createDefault :: Person = { name:: String, e_mail:: String, dateOfBirth:: HtmlDate, gender:: Gender } :: Gender = Female | Male

7 Basic i-Tasks: editors for web forms  An i-Task task of abstract type Task a delivers a value of type a  involves ≥ 0 interactions with a user  It is either not active, active, or finished.  Basic task editors to create and change a value of (almost) any type a: editTask :: String a  Task a| iData a editTaskPred :: a (a  (Bool, [BodyTag]))  Task a| iData a  iData  overloading context restriction requires instances of a bunch of generic functions  can all, on request, automatically be derived by the compiler  iTasks editors can be generated for (almost) any type  storage options can be assigned to any task: task storage_option Page, Session, Clienton client in html page TxtFile, DataFile, Databaseon server in text format, fast binary format, database Tempnot stored

8 A few combinators, there are many more… Sequencing of tasks: monads (=>>) infix 1 :: (Task a) (a  Task b)  Task b | iData b return_V :: a  Task a | iData a Prompting operator: displays Html text as long as a task is activated: (?>>) infix 5 :: [BodyTag] (Task a)  Task a| iData a Repeat forever: foreverTask:: (Task a)  Task a | iData a Select 1 task to do out of n: chooseTask:: [(String,Task a)]  Task a | iData a Or Task: do both tasks concurrently in any order, finish as soon as one of them completes (-||-) infixr 3:: (Task a) (Task a)  Task a | iData a Assign a task to a user, every user has a unique id (UserId :== Int) infix 3 :: UserId (Task a)  Task a | iData a

9 ExampleExample: Check and Double-Check Check 1: by predicateCheck 2: by application user One can imagine that this is all done on the Client side !

10 Check and Double-Check i-Task Specification General Recipe to check and double-check the correctness of any value of any type… doubleCheckForm :: a (a  (Bool, [BodyTag]))  Task a | iData a doubleCheckForm a preda =[Txt "Please fill in the form:"] ?>> editTaskPred a preda =>> \na  [Txt "Received information:", toHtml na, Txt "Is everything correct ?"] ?>> chooseTask [ ("Yes", return_V True), ("No", return_V False) ] =>> \ok  if ok (return_V na) (doubleCheckForm na preda) doubleCheckPerson :: Person  Task Person doubleCheckPerson = doubleCheckForm createDefault checkPerson where checkPerson person = … example = doubleCheckPerson createDefault

11 Delegate: assigning tasks to users exampleexample :: Task Person example = foreverTask delegate delegate =[Txt "Define new initial form:"] ?>> editTask "onServer" createDefault =>> \fi  [Txt "Assign first worker:"] ?>> editTask "Assign" 1 =>> \w1  [Txt "Assign second worker:"] ?>> editTask "Assign" 2 =>> \w2  fillform w1 fi -||- fillform w2 fi =>> \fr  [Txt "resulting form received from fastest worker:", toHtml fr] ?>> editTask "OK" Void where fillform w f = doubleCheckPerson f

12 Delegate – Task Tree Snapshot =>> 0 =>>

13 Basic Implementation Scheme: Task Tree Reconstruction  Flow is specified in one Clean application serving all users  An i-Task specification reads like a book  because it gives the illusion that it step-by-step interacts with the user like standard IO for a desktop application  In reality it starts from scratch every time information is committed, and dies  It reconstructs the Task Tree, starting from the root  finds previous evaluation point  It deals with Multiple Users  Sequential handling of requests: users are served one-by-one  It determines the resulting html code for all users  but it shows only the html code intended for a specific user  It stores state information in the html page, databases, files for the next request  Depending on the task options chosen

14 Optimization I: Global Task Rewriting  Can this be efficient?  Over time, more and more tasks are created  the reconstruction of the Task Tree will take more and more time as well  Speed-up re-construction of the Task Tree: Global Task Rewriting  Tasks are rewritten in (persistent) storages just like functions !  The result of a task is remembered, not how a task accomplished  Tail recursion / repetition is translated to a Loop  Task Tree will not grow infinitely  Garbage collection of stored iTasks which are not needed anymore  The efficiency is not bad at all, but for large systems we can do better

15 Optimization II: Local Task Rewriting – Basic idea  Local Task Rewriting  Avoid complete Task Tree reconstruction all the way from the root  Only locally rewrite the different tasks (sub tree) a user is working on  Use “Ajax” technology and only update on web page what has to change  Transparent: (almost) no changes in the original workflow specification  Each tasks assigned to a user with combinator is rewritten “locally”  Fine grain control: any i-Task can assigned to be rewritten “locally”  any_task_expression

16 Delegate using Ajax exampleexample :: Task Person example = foreverTask delegate delegate =[Txt "Define new initial form:"] ?>> editTask "onServer" createDefault =>> \fi  [Txt "Assign first worker:"] ?>> editTask "Assign" 1 =>> \w1  [Txt "Assign second worker:"] ?>> editTask "Assign" 2 =>> \w2  fillform w1 fi -||- fillform w2 fi =>> \fr  [Txt "resulting form received from fastest worker:", toHtml fr] ?>> editTask "OK" Void where fillform w f = doubleCheckPerson f

17 Delegate Ajax – Task Tree Snapshot =>> 0 =>>

18 Optimization II: Local Task Rewriting - Implementation  Property: any Sub-Tree in the Task Tree can be reconstructed from scratch !  Thread Storage: to store closures: an iTask combinator call + its arguments  stored closure serves as kind of call-back function or thread which can handle all events of all subtasks in the subtree  Global Effects Storage for every user  locally one cannot detect global effects  administrate which tasks are deleted, the fact that new tasks are assigned  Rewrite-o-matic: from Local Task Rewriting stepwise to Global Task Rewriting  Threads can be nested, and can partly overlap  when a thread is finished locally rewrite parent thread, and so on...  Switch back to top level Global Task Rewriting  when parent thread belongs to another user  when there are global effects administrated affecting the user

19 Optimization III: Client Side Local Task Rewriting  Even better to avoid web traffic overhead: Client Side Local Task Rewriting  Transparent: (almost) no changes in the original workflow specification  In the workflow specification, any i-Task can be turned into a Client Thread  any_task_expression

20 Delegate using Sapl & Ajax exampleexample :: Task Person example = foreverTask delegate delegate =[Txt "Define new initial form:"] ?>> editTask "onServer" createDefault =>> \fi  [Txt "Assign first worker:"] ?>> editTask "Assign" 1 =>> \w1  [Txt "Assign second worker:"] ?>> editTask "Assign" 2 =>> \w2  fillform w1 fi -||- fillform w2 fi =>> \fr  [Txt "resulting form received from fastest worker:", toHtml fr] ?>> editTask "OK" Void where fillform w f = doubleCheckPerson f

21 Optimization III: Client Side Local Task Rewriting  The whole i-Task machinery has to run in the browser as well !!!!!!!  We use Jan-Martin Jansen’s SAPL interpreter: fastest, small, in C & Java (TFP '06)  The whole Clean iTask application is compiled to SAPL code  “simple” iTask: > 7000 functions, functions can be large (> chars)  The SAPL interpreter + SAPL iTask code is loaded as Java Applet in the web page  2 almost identical iTask images: Clean.exe on server, SAPL code on Client  A Clean function call can be translated to an equivalent SAPL function call  When a Client thread is created (SAPL), a Server thread is made as well (Clean)  We can choose where to evaluate: Client or Server  If it cannot be done on the Client, we can do it on the Server

22 Optimization III: Client Side Local Task Rewriting  When an event occurs, we know it's prime destination: Client or Server  The Client basically performs the same actions as the Server but it cannot deal with  global effects  persistent storage handling (access to files, databases)  parent threads from other users  threads to be evaluated on server  new threads created for other users  Rewrite-o-matic  in case of panic the Client evaluation stops  switch back to Server Side Local Task Rewriting

23 Conclusions  i-Tasks allow a Concise Executable Specification of Multi-User Workflows  Thanks to an innovative and impressive implementation machinery  All details are handled automatically  With "options" the implementation can be fine-tuned, code remains the same  Sever side Global Task Rewriting »Fast Task Tree reconstruction, whole new web page is generated  Server side Local Task Rewriting using Ajax technology »Faster for large workflows: Task Tree reconstruction of a Sub-Tree »Only corresponding part of the web page is updated  Client side Local Task Rewriting using the SAPL interpreter »Less internet overhead SAPL not as fast as Clean »More concurrency