DIRECTORY AMBridge, AMTypes, Atom, Basics, BasicTime, Commander, ComputeClientInternal, ComputeServer, ComputeServerClient, ComputeServerUser, ComputeServerControllerRpcControl, ComputeServerRpcControl, GVBasics, GVNames, Interpreter, IO, PrincOps, Process, PupDefs, PupErrors, PupTypes, Rope, RPC; ComputeClientInitAndStatusImpl: CEDAR MONITOR IMPORTS AMBridge, Commander, ComputeClientInternal, ComputeServerControllerRpcControl, GVNames, IO, Interpreter, Process, PupDefs, PupErrors, Rope, RPC EXPORTS ComputeClientInternal = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; NoOfGetControllerInterfaceProcesses: INT _ 0 ; FirstTryToGetController: BOOL _ TRUE; GetControllerInterfaceProcess: PUBLIC PROC [forceImport: BOOL _ FALSE] = { MakeSureThereIsOne: ENTRY PROC RETURNS [exit: BOOL _ FALSE] = { IF NoOfGetControllerInterfaceProcesses = 0 THEN NoOfGetControllerInterfaceProcesses _ 1 ELSE RETURN[TRUE]; }; NowWeAreGone: ENTRY PROC = { NoOfGetControllerInterfaceProcesses _ 0}; importedControllerInterface: ComputeServerControllerRpcControl.InterfaceRecord _ NIL; IF forceImport THEN { DO IF ~MakeSureThereIsOne[] THEN EXIT; Process.Pause[5]; ENDLOOP; } ELSE {IF MakeSureThereIsOne[] THEN RETURN;}; FirstTryToGetController _ TRUE; WHILE importedControllerInterface = NIL DO info: GVNames.ConnectInfo; connect: GVBasics.Connect; localImportWorked: BOOL _ FALSE; [info: info, connect: connect ] _ GVNames.GetConnect[ComputeClientInternal.ControllerGVName]; IF (info = individual OR info = group) AND Rope.Equal[connect, ComputeClientInternal.myNetAddressRope] THEN TRUSTED { result: AMTypes.TV; localImportWorked _ TRUE; importedControllerInterface _ NEW[ComputeServerControllerRpcControl.InterfaceRecordObject]; result _ Interpreter.Evaluate["ComputeControllerImpl.FindService"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubFindService _ lFindService; MyFindService _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.FindServiceWithQueueing"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubFindServiceWithQueueing _ lMyFindServiceWithQueueing; MyFindServiceWithQueueing _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.NewStats"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubNewStats _ lNewStats; MyNewStats _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.BestServerStats"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubBestServerStats _ lBestServerStats; MyBestServerStats _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerPackagesImpl.NoticeNewPackage"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubNoticeNewPackage _ lNoticeNewPackage; MyNoticeNewPackage _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerPackagesImpl.RemoveOldPackage"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubRemoveOldPackage _ lRemoveOldPackage; MyRemoveOldPackage _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.GetSomeInfo"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubGetSomeInfo _ lGetSomeInfo; MyGetSomeInfo _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.CommandUnavailable"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubCommandUnavailable _ lCommandUnavailable; MyCommandUnavailable _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate["ComputeControllerImpl.ExtraCommandAvailable"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubExtraCommandAvailable _ lExtraCommandAvailable; MyExtraCommandAvailable _ LOOPHOLE[AMBridge.TVToProc[result]]; result _ Interpreter.Evaluate[ "ComputeControllerImpl.MightAcceptQueuedCommand"].result; IF result = NIL THEN localImportWorked _ FALSE; importedControllerInterface.clientStubMightAcceptQueuedCommand _ lMightAcceptQueuedCommand; MyMightAcceptQueuedCommand _ LOOPHOLE[AMBridge.TVToProc[result]]; }; IF ~localImportWorked THEN { importedControllerInterface _ NIL; importedControllerInterface _ ComputeServerControllerRpcControl.ImportNewInterface[interfaceName: [ type: "ComputeServerController.summoner", instance: ComputeClientInternal.ControllerGVName, version: [1,1]] ! RPC.ImportFailed => { Process.Pause[Process.SecondsToTicks[13]]; CONTINUE; }; ]; }; FirstTryToGetController _ FALSE; ENDLOOP; ComputeClientInternal.ControllerInterface _ importedControllerInterface; NowWeAreGone[]; }; TryToImportController: PUBLIC PROC = { IF NoOfGetControllerInterfaceProcesses = 1 THEN RETURN; TRUSTED {Process.Detach[FORK GetControllerInterfaceProcess[]]; }; Process.Pause[Process.SecondsToTicks[1]]; WHILE NoOfGetControllerInterfaceProcesses = 1 AND FirstTryToGetController DO Process.Pause[Process.SecondsToTicks[1]]; ENDLOOP; }; MyFindService: PROC [service: Rope.ROPE] RETURNS [found: BOOL, instance: RPC.ShortROPE]; MyFindServiceWithQueueing: PROC [service: Rope.ROPE, version: RPC.ShortROPE, timeToWait: INT, clientMachineName: RPC.ShortROPE, streamPupAddress: PupDefs.PupAddress, needListener: BOOL] RETURNS [found: ComputeServer.AskResponce, instance: RPC.ShortROPE, serverPupAddress: PupDefs.PupAddress, errMsg: Rope.ROPE]; MyNewStats: PROC [serverMachineName: RPC.ShortROPE, serverMachinePupAddress: RPC.ShortROPE, serverUP: BOOL, firstCall: BOOL, machineType: PrincOps.MachineType, mainMemory: CARDINAL, numberCPUs: CARDINAL, diskPartionSize: INT, freePagesOnDisk: INT, freeboard: INT, freeGFI: CARDINAL, freeMDS: CARDINAL, freeVM: CARDINAL, oldestLRUFileDate: BasicTime.GMT, CPULoad: REAL, reclamationRate: REAL, freeProcesses: CARDINAL] RETURNS [terminateService, newPackage: BOOL, queueingCommands: LIST OF Rope.ROPE]; MyBestServerStats: PROC RETURNS[instance: RPC.ShortROPE, FOM: REAL] ; MyNoticeNewPackage: PROC [package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE]; MyRemoveOldPackage: PROC [package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE]; MyGetSomeInfo: PROC RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE, serverList: LIST OF Rope.ROPE, bestFOM: REAL]; MyCommandUnavailable: PROC [serverMachineName: RPC.ShortROPE, commandName: Rope.ROPE, version: RPC.ShortROPE]; MyExtraCommandAvailable: PROC [serverMachineName: RPC.ShortROPE, commandName: Rope.ROPE, version: RPC.ShortROPE]; MyMightAcceptQueuedCommand: PROC [serverMachineAddress: RPC.ShortROPE, commandName: Rope.ROPE]; lFindService: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, service: Rope.ROPE] RETURNS [found: BOOL, instance: RPC.ShortROPE] = { RETURN MyFindService[service]; }; lMyFindServiceWithQueueing: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, service: Rope.ROPE, version: RPC.ShortROPE, timeToWait: INT, clientMachineName: RPC.ShortROPE, streamPupAddress: PupDefs.PupAddress, needListener: BOOL] RETURNS [found: ComputeServer.AskResponce, instance: RPC.ShortROPE, serverPupAddress: PupDefs.PupAddress, errMsg: Rope.ROPE] = { RETURN MyFindServiceWithQueueing[service, version, timeToWait, clientMachineName, streamPupAddress, needListener]; }; lNewStats: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, serverMachineName: RPC.ShortROPE, serverMachinePupAddress: RPC.ShortROPE, serverUP: BOOL, firstCall: BOOL, machineType: PrincOps.MachineType, mainMemory: CARDINAL, numberCPUs: CARDINAL, diskPartionSize: INT, freePagesOnDisk: INT, freeboard: INT, freeGFI: CARDINAL, freeMDS: CARDINAL, freeVM: CARDINAL, oldestLRUFileDate: BasicTime.GMT, CPULoad: REAL, reclamationRate: REAL, freeProcesses: CARDINAL] RETURNS [terminateService, newPackage: BOOL, queueingCommands: LIST OF Rope.ROPE] = { RETURN MyNewStats[serverMachineName, serverMachinePupAddress, serverUP, firstCall, machineType, mainMemory, numberCPUs, diskPartionSize, freePagesOnDisk, freeboard, freeGFI, freeMDS, freeVM, oldestLRUFileDate, CPULoad, reclamationRate, freeProcesses]; }; lBestServerStats: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord] RETURNS[instance: RPC.ShortROPE, FOM: REAL] = { RETURN MyBestServerStats[]; }; lNoticeNewPackage: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE] = { RETURN MyNoticeNewPackage[package]; }; lRemoveOldPackage: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, package: RPC.ShortROPE] RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE] = { RETURN MyRemoveOldPackage [package]; }; lGetSomeInfo: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord] RETURNS [error: BOOL, tryDifferentController: BOOL, msg: Rope.ROPE, serverList: LIST OF Rope.ROPE, bestFOM: REAL] = { RETURN MyGetSomeInfo[]; }; lCommandUnavailable: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, serverMachineName: RPC.ShortROPE, commandName: Rope.ROPE, version: RPC.ShortROPE] = { MyCommandUnavailable[serverMachineName, commandName, version]; }; lExtraCommandAvailable: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, serverMachineName: RPC.ShortROPE, commandName: Rope.ROPE, version: RPC.ShortROPE] = { MyExtraCommandAvailable[serverMachineName, commandName, version]; }; lMightAcceptQueuedCommand: PROC [interface: ComputeServerControllerRpcControl.InterfaceRecord, serverMachineAddress: RPC.ShortROPE, commandName: Rope.ROPE] = { MyMightAcceptQueuedCommand[serverMachineAddress, commandName]; }; PokeTheController: PUBLIC PROC = { seventeenSecondsInTicks: Process.Ticks = Process.SecondsToTicks[17]; DO tempControllerInterface: ComputeServerControllerRpcControl.InterfaceRecord _ ComputeClientInternal.ControllerInterface; tryDifferentController: BOOL _ FALSE; IF tempControllerInterface = NIL THEN TryToImportController[] ELSE { [tryDifferentController: tryDifferentController] _ tempControllerInterface.GetSomeInfo[ ! RPC.CallFailed => { ComputeClientInternal.ControllerInterface _ NIL; TryToImportController[]; CONTINUE; }; ]; }; IF tryDifferentController THEN { TryToImportController[]; }; Process.Pause[seventeenSecondsInTicks]; ENDLOOP; }; ClientRequests: Commander.CommandProc = { serviceList: LIST OF REF ComputeClientInternal.ServiceListObject; serviceList _ ComputeClientInternal.GetCurrentServices[]; WHILE serviceList # NIL DO serverName: ROPE _ serviceList.first.serverInstance; serverName _ PupDefs.GetHostName[serviceList.first.listenerPupAddress]; IF msg # NIL THEN msg _ Rope.Concat[msg, "\n"]; msg _ Rope.Concat[msg, IO.PutFR[" %g running on %g (%g) ", IO.rope[serviceList.first.command], IO.rope[serverName], IO.rope[serviceList.first.serverInstance]]]; serviceList _ serviceList.rest; ENDLOOP; }; Commander.Register[key: "///Commands/SummonerClientRequests", proc: ClientRequests, doc: "Print all active requests"]; END. ฎComputeClientInitAndStatusImpl.mesa Client side of the interface implementation. Last Edited by: Bob Hagmann, October 8, 1985 1:37:59 pm PDT Spreitzer, September 3, 1985 3:40:52 pm PDT Copyright c 1984 by Xerox Corporation. All rights reserved. Declarations Service Initialization and Status Dummies to strip off an arg for the local call Revalidate Controller Interface cache Print all active requests Initialization Bob Hagmann March 10, 1985 12:14:31 pm PST changes to: ClientMachineName, StreamPupAddress, myNetAddressRope, StartService, name, clientMachineName, StreamPupAddress, myNetAddressRope Bob Hagmann June 20, 1985 7:35:44 am PDT added retries to BestServerStats ส T– "Cedar" style˜headšœ#™#Ibodyšœ,™,L™;code™+Jšœ ฯmœ1™NšœX˜XNšžœ žœžœžœ˜/Nšœ[˜[Nšœžœ˜AN˜—šžœžœ˜Nšœžœ˜"šœฯ˜ฯšœžœ˜Nšœ*˜*Nšžœ˜ Nšœ˜—Nšœ˜—N˜—Nšœžœ˜ Nšžœ˜—NšœH˜HNšœ˜N˜—šะbnœžœžœ˜&Nšžœ)žœžœ˜7Nšžœžœ%˜ANšœ)˜)šžœ)žœž˜LNšœ)˜)Nšžœ˜—N˜——™.Jš Ÿ œžœžœžœ žœ žœ ˜XJšŸœžœžœ žœžœžœ@žœžœ.žœEžœ˜ฝJš.ฯb œžœžœ%žœžœ žœ1žœžœžœžœ žœ žœ žœ žœžœ žœžœžœžœ žœžœžœžœ˜๔Jš Ÿœžœžœ žœ žœžœ˜FJšŸœžœ žœ žœ žœžœ žœ˜vJšŸœžœ žœ žœ žœžœ žœ˜vJšŸ œžœžœ žœžœ žœžœžœžœ žœ˜‡Jš Ÿœžœžœžœ žœ ˜nJš Ÿœžœžœžœ žœ ˜qJšŸœžœžœžœ˜_J˜š ก œžœNžœžœ žœ žœ˜™Jšžœ˜J˜—šกœžœNžœ žœžœžœ@žœžœ.žœ?žœ˜๙Jšžœl˜rJ˜—š.ก œžœSžœ%žœžœ žœ1žœžœžœžœ žœ žœ žœ žœžœ žœžœžœžœ žœžœžœžœ˜ณJšžœ๕˜๛J˜—šŸœžœžœ<ž œ žœ žœžœ˜…Jšžœ˜J˜—šกœžœIžœ žœ žœžœ žœ˜ถJšžœ˜#J˜—šกœžœIžœ žœ žœžœ žœ˜ถJšžœ˜$J˜—šก œžœ@žœ žœžœ žœžœžœžœ žœ˜ศJšžœ˜J˜—š ŸœžœSžœžœ žœ˜ฎJšœ>˜>J˜—š กœžœSžœžœ žœ˜ฑJšœA˜AJ˜—šกœžœVžœžœ˜ŸJšœ>˜>J˜—J˜—™%š œžœžœ˜#JšœD˜Dšž˜Jšœw˜wJšœžœžœ˜%Jšžœžœžœ˜=šœžœ˜šœZžœ˜nNšœ,žœ˜0Nšœ˜Nšžœ˜ Nšœ˜—J˜Jšœ˜—šžœžœ˜ Nšœ˜J˜—Jšœ'˜'Jšžœ˜—J˜J˜——šœ™šกœ˜*Jšœ žœžœžœ)˜AJšœ9˜9šžœžœž˜Jšœ žœ$˜4JšœH˜HJšžœžœžœ˜/Jš œžœ"žœ"žœžœ*˜กJšœ˜Jšžœ˜—J˜J˜——™Nšœv˜vNšžœ˜—™*Mšœ ฯr€™Œ—™(Mšœข™ —M™—…—,"9$