AmpersandTarski / RAP

RAP is a tool that lets you analyse Ampersand models, generate functional specifications and make prototypes of information systems. It is the primary tool for students of the Open University of the Netherlands in the course Rule Based Design.
5 stars 3 forks source link

503 Service Temporarily Unavailable in rap.tarski.nl #289

Open stefjoosten opened 1 year ago

stefjoosten commented 1 year ago

De situatie

Bij het draaien van een script kreeg ik een onverwachte foutmelding: afbeelding

Ik draaide het script "ProjectAdministration" in rap.tarski.nl. Dit script is een bewerkte versie van het project management prototype, omdat ik de INCLUDE statements niet mag gebruiken in RAP. Ook heb ik LINKTO toegevoegd en View-Property gebruikt om een script te krijgen voor issue AmpersandTarski/prototype#128.

Ik heb het ook gedraaid op rap.cs.ou.nl om te kijken of het iets met de Kubernetes deploment te maken heeft. Maar dit geeft vergelijkbaar gedrag: afbeelding

De volgende error wordt ook nog aangegeven als je het probeert te runnen met docker compose:

#0 1.192 Error while reading template.
#0 1.192 File could not be read: /var/www/templates/Box-FORMS.html
#0 1.192 /var/www/templates/Box-FORMS.html: openFile: does not exist (No such file or directory)
#0 1.192 2023-05-11 09:44:15.424297: [error] ExitFailure 130
------
failed to solve: executor failed running [/bin/sh -c ampersand proto /usr/local/project/ProjectAdministration.adl   --proto-dir /var/www   --crud-defaults cRud   --verbose]: exit code: 130

Symptomen

Later merkte ik dat het script "Flight reservations" wel goed werkt. Beide scripts staan hieronder in dit issue. Als je het reproduceert, wel even opletten dat je de cache tijdig ververst c.q. uitschakelt bij het omschakelen tussen beide scripts... Het grote verschil tussen beide scripts is dat "ProjectAdministration" veel gebruik maakt van front-end functionaliteit. We kunnen dus vaststellen dat er een fout zit in de bestaande RAP. Op rap.cs.ou.nl is die afkomstig van het (gepubliceerde) image ampersandtarski/ampersand-rap:2021-10-22. Ik weet niet waar rap.tarski.nl zijn image vandaan haalt...

Actie

We moeten beslissen of het nog de moeite waard is om dit issue uit te lopen. Daarom heb ik @Michiel-s aan de assignees toegevoegd.

Context / Source van ampersand script

Het volgende script werkt prima:

CONTEXT "Flight reservations"
PURPOSE CONTEXT "Flight reservations"
{+ 
Tim's requirements:
1. Users have to enter a list of passengers for which to book tickets.
2. At least one of these passengers has to be an adult.
3. After a valid list of passengers has been entered, users have to pick seats.
4. Only free seats may be picked.
5. Every passenger must have exactly one seat.
6. Multiple users should be able to book tickets at the same time.

Stef's requirements
1. Each booking must involve at least one adult.
2. Each passenger must have a nonempty name and an age.
3. Each occupancy involves the flight, the seat number, and the passenger.
4. Each passenger aboard the plane occupies only one seat.
5. The flight and the seat number define an occupancy uniquely.
+}

age       :: Person -> Int
POPULATION age CONTAINS [ ("p0", "87"), ("p1", "85") ]
name      :: Person -> Name
POPULATION name CONTAINS [ ("p0", "Statler"), ("p1", "Waldorf") ]
VIEW Person: Person{ "name": name} ENDVIEW

RULE "nonempty names": name = name-(name;"")
MESSAGE "One or more names are empty."
VIOLATION (TXT "Please enter a name for passenger ", SRC I)

ROLE Manager MAINTAINS "Adult on every booking"
RULE "Adult on every booking" : I[Booking] |- reservations;passenger;adult;V
MESSAGE "Your booking must involve at least one adult."
VIOLATION (TXT "Passenger(s) ", SRC reservations;passenger, TXT " must be accompanied by an adult.")

RULE "Valid Seat Number": flight~;reservations;seat |- plane;seatnr
MESSAGE "You are trying to book a seat number that does not exist on your flight."
VIOLATION (TXT "Vessel ", SRC plane, TXT " has no seat ", TGT I, TXT ".")
IDENT Reservation : Reservation(reservations~;flight,seat)

reservations :: Booking * Reservation [INJ]
RELATION adult[Person] [PROP] = [ ("p0", "p0"), ("p1", "p1") ]
by        :: Booking -> Name
passenger :: Reservation -> Person
flight    :: Booking -> Flight
seat      :: Reservation -> SeatNumber
plane     :: Flight -> Vessel
POPULATION plane CONTAINS [ ("KL1204", "PH-AON") ]
seatnr    :: Vessel * SeatNumber
POPULATION seatnr CONTAINS [ ("PH-AON", "1A"), ("PH-AON", "1B"), ("PH-AON", "1C") ]

VIEW Reservation : Reservation (flight:reservations~;flight, TXT ", seat nr. ", seat:seat)

INTERFACE "Overview" : "_SESSION"[SESSION] BOX<TABS>
   [ Flights : V[SESSION*Flight]
   , Reservations : V[SESSION*Reservation]
   , Persons : V[SESSION*Person]
   , Occupancies : V[SESSION*Flight]
   ]

INTERFACE Booking : I[Booking]
BOX
   [ "booking door" : by
   , flight : flight
   , reservations : reservations INTERFACE Reservation
   ]

INTERFACE "Seats" : I[Flight]
BOX
   [ flight : I cRud
   , occupied : flight~;reservations;seat cRud
   , vacant : plane;seatnr - flight~;reservations;seat cRud
   ]

INTERFACE "Reservation" : I[Reservation]
BOX
   [ resNr : I
   , passenger : passenger BOX
      [ name : name
      , adult : adult
      , age : age
      ]
   , seat : seat
   ]

INTERFACE "Person" : I[Person]
BOX
   [ name : name
   , age : age
   ]

ENDCONTEXT

Het volgende script geeft de beschreven fout:

CONTEXT "ProjectAdministration" IN ENGLISH
  -- INCLUDE "ProjectAdministration.xlsx"

  -- INCLUDE "ProjectLeader.ifc"

--[ Conceptual model (including concepts and relations) ]----------------------
  CONCEPT Project "Planned set of interrelated tasks"
    projectName           :: Project * ProjectName [UNI,TOT]
    projectStatus         :: Project * ProjectStatus [UNI,TOT]
    projectDescription    :: Project * Description [UNI]
    projectStartDate      :: Project * Date [UNI]
    projectActive         :: Project * Project [PROP]
    projectKeyword        :: Project * Keyword
    pl                    :: Project * Person [UNI]
    member                :: Project * Person

    someAlphanumeric      :: Project * SomeAlphanumeric [UNI]
    someBigalphanumeric   :: Project * SomeBigalphanumeric [UNI]
    someHugeAlphanumeric  :: Project * SomeHugeAlphanumeric [UNI]
    somePassword          :: Project * SomePassword [UNI]
    someDate              :: Project * SomeDate [UNI]
    someDateTime          :: Project * SomeDateTime [UNI]
    someBoolean           :: Project * SomeBoolean [UNI]
    someInteger           :: Project * SomeInteger [UNI]
    someFloat             :: Project * SomeFloat [UNI]
    someObject            :: Project * Person [UNI]

    someAlphanumericX      :: Project * SomeAlphanumeric
    someBigalphanumericX   :: Project * SomeBigalphanumeric
    someHugeAlphanumericX  :: Project * SomeHugeAlphanumeric
    somePasswordX          :: Project * SomePassword
    someDateX              :: Project * SomeDate
    someDateTimeX          :: Project * SomeDateTime
    someBooleanX           :: Project * SomeBoolean
    someIntegerX           :: Project * SomeInteger
    someFloatX             :: Project * SomeFloat
    someObjectX            :: Project * Person

  CONCEPT Person "Person"
    personFirstName       :: Person * FirstName [UNI]
     = [("p10001", "A."), ("p10002", "B."), ("p10003", "C.")]
    personLastName        :: Person * LastName [UNI]
     = [("p10001", "Arends"), ("p10002", "Billekens"), ("p10003", "Curly")]
    personStatus          :: Person * PersonStatus [UNI]
     = [("p10001", "Niet meer in dienst.")]
    personEmail           :: Person * Email [UNI]
     = [("p10001", "arends@example.com"), ("p10002", "billekens@example.com"), ("p10003", "curly@example.com")]
    workswith             :: Person * Person [IRF,SYM]
     = [("p10001", "p10002"), ("p10001", "p10003"), ("p10002", "p10001"), ("p10003", "p10001")]

  REPRESENT Date TYPE DATE
  REPRESENT ProjectName, ProjectStatus, Keyword TYPE ALPHANUMERIC
  REPRESENT FirstName, LastName, PersonStatus, Email TYPE ALPHANUMERIC

  REPRESENT SomeAlphanumeric, SomeAlphanumericX TYPE ALPHANUMERIC
  REPRESENT SomeBigalphanumeric, SomeBigalphanumericX TYPE BIGALPHANUMERIC
  REPRESENT SomeHugeAlphanumeric, SomeHugeAlphanumericX TYPE HUGEALPHANUMERIC
  REPRESENT SomePassword, SomePasswordX TYPE PASSWORD
  REPRESENT SomeDate, SomeDateX TYPE DATE
  REPRESENT SomeDateTime, SomeDateTimeX TYPE DATETIME
  REPRESENT SomeBoolean, SomeBooleanX TYPE BOOLEAN
  VIEW SomeBooleanX : SomeBooleanX HTML TEMPLATE "View-PROPERTY.html" ENDVIEW
  REPRESENT SomeInteger, SomeIntegerX TYPE INTEGER
  REPRESENT SomeFloat, SomeFloatX TYPE FLOAT

--[ Invariant rules ]----------------------------------------------------------
  RULE "r1" : I[Project] |- projectName;projectName~
  MEANING "Every project MUST have a name"
  MESSAGE "There are projects that don't have a name"
  VIOLATION ( TXT "Project "
            , SRC I
            , TXT " does not have a name"
            )
  ROLE "Planner" MAINTAINS "r1"

  RULE "Active projects must have a projectleader" : projectActive |- I /\ pl;pl~

  ROLE "ExecEngine" MAINTAINS "Every projectleader is also projectmember"
  RULE "Every projectleader is also projectmember" : pl |- member
  VIOLATION (TXT "{EX}InsPair;member;Project;", SRC I, TXT ";Person;", TGT I)

--[ Public interfaces ]--------------------------------------------------------
  INTERFACE "Active projects" : V[SESSION*Project];projectActive BOX <FORM>
    [ "Projects"      : I[Project]
    , "Members FORM"  : member CRUD BOX <FORM> -- <<-- this is the CRUD functionality we need for FORMS
      [ "ID"          : I cRud <PersonNoView>
      , "First name"  : personFirstName CRUD
      , "Last name"   : personLastName CRUD
      ]
    , "Members TABLE" : member CRUD BOX <TABLE> -- <<-- this is the CRUD functionality we need for TABLES
      [ "ID"          : I cRud <PersonNoView>
      , "First name"  : personFirstName CRUD
      , "Last name"   : personLastName CRUD
      ]
    , "Members TABS"  : member CRUD BOX <TABS> -- <<-- this is the CRUD functionality we need for TABS
      [ "Person details" : I BOX <FORM>
        [ "ID"         : I cRud <PersonNoView>
        , "First name" : personFirstName CRUD
        , "Last name"  : personLastName CRUD
        ]
      , "Contact details" : I BOX <FORM>
        [ "ID"         : I cRud <PersonNoView>
        , "Email"      : personEmail CRUD
        ]
      ]
    ]

  INTERFACE "Project" : I[Project] cRud BOX <FORM title="Project form" showNavMenu>
    [ "Name"                 : projectName
    , "Description"           : projectDescription
    , "(Planned) start date"  : projectStartDate
    , "Status"                : projectStatus
    , "Active"                : projectActive 
    , "Current PL"            : pl
    , "Project members"       : member BOX <TABLE title="Project members">
      [ "Name"                : personFirstName
      , "Email"               : personEmail
      ]

    , "Alphanumeric uni"      : someAlphanumeric
    , "Bigalphanumeric uni"   : someBigalphanumeric
    , "HugeAlphanumeric uni"  : someHugeAlphanumeric
    , "Password uni"          : somePassword
    , "Date uni"              : someDate
    , "DateTime uni"          : someDateTime
    , "Boolean uni"           : someBoolean
    , "Integer uni"           : someInteger
    , "Float uni"             : someFloat
    , "Object uni"            : someObject

    , "Alphanumeric"          : someAlphanumericX
    , "Bigalphanumeric"       : someBigalphanumericX
    , "HugeAlphanumeric"      : someHugeAlphanumericX
    , "Password"              : somePasswordX
    , "Date"                  : someDateX
    , "DateTime"              : someDateTimeX
    , "Boolean"               : someBooleanX
    , "Integer"               : someIntegerX
    , "Float"                 : someFloatX
    , "Object"                : someObjectX
    ]

  INTERFACE "Person"    : I[Person] CRuD BOX <FORM>
    [ "First name"      : personFirstName RU
    , "Last name"       : personLastName RU
    , "Status"          : personStatus RU
    , "Email"           : personEmail RU
    , "Projects TABS"        : I BOX <TABS>
      [ "Active"            : (member~ \/ pl~);projectActive
      , "Active IFC"        : (member~ \/ pl~);projectActive INTERFACE Project
      , "Active LINKTO IFC" : (member~ \/ pl~);projectActive LINKTO INTERFACE Project
      , "Inactive"      : (member~ \/ pl~);(-projectActive)
      ]
    , "Projects FORMS"        : I BOX <FORMS>
      [ "Active"            : (member~ \/ pl~);projectActive
      , "Active IFC"        : (member~ \/ pl~);projectActive INTERFACE Project
      , "Active LINKTO IFC" : (member~ \/ pl~);projectActive LINKTO INTERFACE Project
      , "Inactive"      : (member~ \/ pl~);(-projectActive)
      ]
    , "Projects TABLE"        : I BOX <TABLE>
      [ "Active"            : (member~ \/ pl~);projectActive
      , "Active IFC"        : (member~ \/ pl~);projectActive INTERFACE Project
      , "Active LINKTO IFC" : (member~ \/ pl~);projectActive LINKTO INTERFACE Project
      , "Inactive"      : (member~ \/ pl~);(-projectActive)
      ]
    , "Works with"      : workswith
    ]

--[ Interfaces for planner ]---------------------------------------------------
  INTERFACE "Inactive projects" FOR "Planner" : V[SESSION*Project];(-(projectActive) /\ I) BOX <TABLE noHeader noRootTitle>
    [ "Name"            : I
    , "Description"     : projectDescription
    , "Projectleider"   : pl RU
    , "Status"          : projectStatus
    , "Active"          : projectActive RU
    ]

  INTERFACE "People"  FOR "Planner" : V[SESSION*Person] cRud BOX
    [ "Person"          : I[Person]
    , "Email"           : personEmail
    , "Projects"        : member~ LINKTO INTERFACE Project
    ]

  VIEW "ProjectName"  : Project DEFAULT { name : projectName } ENDVIEW
  VIEW "PersonName"   : Person DEFAULT { firstName : personFirstName, txt1: TXT " ", lastName : personLastName } ENDVIEW
  VIEW "PersonNoView" : Person {} ENDVIEW

--[ Interfaces for project leader ]--------------------------------------------
  INTERFACE "My projects" : V[SESSION*Project];pl BOX <TABLE>
    [ "Projectleader"       : I
    , "Projects"            : pl~
    ]

  INTERFACE "New/edit project" : I[Project] CRuD BOX
    [ "Name"                : projectName RU
    , "Description"         : projectDescription RU
    , "Start date"          : projectStartDate RU
    , "Status"              : projectStatus RU
    , "Active"              : projectActive RU
    , "Keywords"            : projectKeyword RU
    , "Current PL"          : pl RU
    , "Project members"     : member RU

    , "Alphanumeric uni"      : someAlphanumeric RU
    , "Bigalphanumeric uni"   : someBigalphanumeric RU
    , "HugeAlphanumeric uni"  : someHugeAlphanumeric RU
    , "Password uni"          : somePassword RU
    , "Date uni"              : someDate RU
    , "DateTime uni"          : someDateTime RU
    , "Boolean uni"           : someBoolean RU
    , "Integer uni"           : someInteger RU
    , "Float uni"             : someFloat RU
    , "Object uni"            : someObject RU

    , "Alphanumeric"          : someAlphanumericX RU
    , "Bigalphanumeric"       : someBigalphanumericX RU
    , "HugeAlphanumeric"      : someHugeAlphanumericX RU
    , "Password"              : somePasswordX RU
    , "Date"                  : someDateX RU
    , "DateTime"              : someDateTimeX RU
    , "Boolean"               : someBooleanX RU
    , "Integer"               : someIntegerX RU
    , "Float"                 : someFloatX RU
    , "Object"                : someObjectX RU
    ]

ENDCONTEXT
Michiel-s commented 1 year ago

Hi @stefjoosten

Deze is eenvoudig. In de foutmelding wordt aangegeven dat het template Box-FORMS.html niet gevonden kan worden. Dat klopt ook, want in de standaard templates bestaat alleen FORM (enkelvoud).

Het script compileert bij stap 1 in rap wel, omdat dan niet naar de interface templates wordt gekeken. Dan gaat het alleen om syntax en typechecker.

Pas wanneer het proto command wordt gebruikt krijg je de template fouten.

In het script dus even BOX <FORMS> vervangen door BOX <FORM> en hij doet het weer

stefjoosten commented 1 year ago

Hm. Misschien moeten we deze foutmelding wat meer in het zicht zetten, zodat ik als gebruiker de juiste diagnose zelf kan stellen.

Kennelijk was ik te snel afgeleid en van m'n stuk gebracht door die eerdere foutmeldingen...