XML RPC Module¶
Authors: |
|
---|
Description¶
XML-RPC server for pyCPA. It can be used to interface pycpa with non-python (e.g. close-source) applications.
-
class
pycpa.cparpc.
CPARPC
[source]¶ Basic XML RPC Server for pyCPA.
Methods prefixed with
"xmlrpc_"
are actually callable from the client.Please see
pycpa.model
for more details about the pyCPA model andpycpa.analysis
for information about the analysis.-
debug_prefix
= None¶ Prefix for function calls in debug output
-
id_type
= None¶ Specifies how unique IDs are generated
-
scheduling_policies
= None¶ Dictionary of scheduler classes.
-
xmlrpc_analyze_system
(system_id)[source]¶ Analyze system and return a result id.
Parameters: system_id (string) – ID of the system to analyze Returns: ID of a results object Return type: string
-
xmlrpc_assign_ct_event_model
(task_id, c, T, min_dist)[source]¶ Create an eventmodel and assign it to task. The event model will represent a periodic burst with c activations every T time units, with the activations in each burst being min_dist time units apart from each other.
Parameters: - task_id (string) – ID of the task
- c (integer) – Number of activations per burst
- T (integer) – Period of the bursts
- min_dist (integer) – Minimum distance between events (in unit time)
Returns: 0
-
xmlrpc_assign_pjd_event_model
(task_id, period, jitter, min_dist)[source]¶ Create an eventmodel and assign it to task.
Parameters: - task_id (string) – ID of the task
- period (integer) – Period (in unit time)
- jitter (integer) – Jitter (in unit time)
- min_dist (integer) – Minimum distance between events (in unit time)
Returns: 0
-
xmlrpc_assign_scheduler
(resource_id, scheduler_string)[source]¶ Assign a scheduler to a resource. See
xmlrpc_get_valid_schedulers()
for a list of valid schedulers.Parameters: - resource_id (integer) – ID of the resource to which to assign the scheduler.
- scheduler_string (string) – Identifies the type of scheduler to set.
Returns: 0 for success
-
xmlrpc_clear_models
()[source]¶ Delete all models, i.e. all systems, resources, tasks, results etc.
Returns: 0
-
xmlrpc_end_to_end_latency
(path_id, results_id, n)[source]¶ Perform a path analysis to obtain the end-to-end latency. Requires that the system has been analyzed before to obtain the results_id.
Parameters: - path_id (string) – ID of the path
- results_id (string) – ID of the results
- n (integer) – Number of activations to obtain the latency for
Returns: best- and worst-case latency for n events along path.
Return type: tuple of integers
-
xmlrpc_get_attribute
(obj_id, attribute)[source]¶ Return the attribute of a task.
Parameters: - obj_id (string) – ID of the task to get the parameter from.
- attribute (string.) – Attribute to get.
Returns: Value of the attribute
Return type: Depends on attribute.
-
xmlrpc_get_task_result
(results_id, task_id)[source]¶ Obtain the analysis results for a task.
Parameters: - results_id – ID of the results object
- task_id (string) – ID of the task
Returns: a dictionary of results for task_id.
Return type:
-
xmlrpc_get_valid_schedulers
()[source]¶ Find out which schedulers are supported.
Returns: List of valid schedulers Return type: list of strings
-
xmlrpc_graph_system
(system_id, filename)[source]¶ Generate a graph of the system (in server directory). It uses graphviz for plotting, so the ‘dot’ command must be in the PATH of the server environment.
Parameters: - system_id (string) – ID of the system to analyze
- filename (string) – File name (relative to server working directory) to which to store the graph.
Returns: 0
-
xmlrpc_graph_system_dot
(system_id, filename)[source]¶ Generate a graph of the system in dot file format (in server directory). The resulting file can be converted using graphviz. E.g. to create a PDF, run:
dot -Tpdf <filename> -o out.pdfParameters: - system_id (string) – ID of the system to analyze
- filename (string) – File name (relative to server working directory) to which to write to. If empty, return dot file as string only.
Returns: string representation of graph in dot format
Return type: string
-
xmlrpc_link_task
(task_id, target_id)[source]¶ Make task with target_id dependent of the task with task_id.
Parameters: - task_id (string) – ID of the task that activates the target task
- target_id (string) – ID of the task that is activate by the task.
Returns: 0
-
xmlrpc_new_path
(system_id, name, task_ids, attributes={})[source]¶ Adds a path consisting of a list of tasks to the system.
Parameters: - system_id (string) – ID of the system
- name (string) – Name of the path
- task_ids (list of strings) – List of task ids corresponding to the tasks in the path.
Returns: ID of the created path
Return type: string
-
xmlrpc_new_resource
(system_id, name, attributes={})[source]¶ Create a new resource with name and bind it to a system.
Parameters: - system_id (string) – ID of the system
- name (string) – Name of the resurce.
Returns: ID of the created resource
Return type: string
-
xmlrpc_new_system
(name)[source]¶ create new pycpa system and return it’s id
Parameters: name (string) – Name of the system. Returns: ID of the created system Return type: string
-
xmlrpc_new_task
(resource_id, name, attributes={})[source]¶ Create a new task and bind it to a ressource.
Parameters: - resource_id (string) – ID of the resource
- name (string) – Name of the task.
Returns: ID of the created task
Return type: string
-
xmlrpc_pickle_system
(system_id)[source]¶ Pickle the pycpa system on the server-side
Parameters: system_id (string) – ID of the system to analyze Returns: 0 on sucess
-
xmlrpc_set_attribute
(obj_id, attribute, value)[source]¶ Set the attribute of the object to value.
This method can be used to set any attribute of any previously created object., However, each scheduler or analysis expects certain attributes that must be set and ignores all others. See scheduler documentation for details (e.g.
pycpa.schedulers
).Parameters: - obj_id (string) – ID of the task to set the parameter for.
- attribute (string.) – Attribute to set.
- value (Depends on attribute.) – Value to set the attribute to
Returns: 0
-
xmlrpc_set_id_type
(id_type)[source]¶ Select the type for returned IDs.
- ‘numeric’ generates numeric IDs (strings of long int)
- ‘id_numeric’ like ‘numeric’, but prefixes
'id_'
(makes debug output executable) - ‘name’ generates the ID from the objects’ name
- ‘full’ is like ‘name’, but prefixes name by parent’s name (TODO)
In case of ‘name’ or ‘full’, the ID is suffixed in case of duplicates.
Parameters: id_type (string) – ‘numeric’, ‘id_numeric’, ‘name’, or ‘full’ Returns: 0
-