:py:mod:`k8s_client.views` ========================== .. py:module:: k8s_client.views Subpackages ----------- .. toctree:: :titlesonly: :maxdepth: 3 k8s_config/index.rst users/index.rst Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 contexts/index.rst define_objects/index.rst groups/index.rst mixin/index.rst nodes/index.rst pods/index.rst roles/index.rst Package Contents ---------------- Functions ~~~~~~~~~ .. autoapisummary:: k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_pods k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_nodes k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_contexts k8s_client.views.get_context k8s_client.views.get_context_busy_jobs k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_roles k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_groups k8s_client.views.post_group k8s_client.views.delete_group k8s_client.views.update_group k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_users k8s_client.views.post_user k8s_client.views.delete_user k8s_client.views.update_user k8s_client.views.update_user_password k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.login_user k8s_client.views.uninstall_completed_charts_for_user k8s_client.views.get_user_contexts k8s_client.views.get_user_files k8s_client.views.get_user_file_content k8s_client.views.get_user_folder_content k8s_client.views.upload_file_for_user_full k8s_client.views.upload_file_part_for_user k8s_client.views.delete_file_for_user k8s_client.views.delete_folder_for_user k8s_client.views.get_user_image_tags k8s_client.views.get_user_images k8s_client.views.post_user_image k8s_client.views.put_user_image k8s_client.views.delete_user_image k8s_client.views.upload_file_for_job k8s_client.views.start_job k8s_client.views.kill_job k8s_client.views.cancel_job k8s_client.views.delete_job k8s_client.views.get_jobs k8s_client.views.get_jobs_count k8s_client.views.post_jobs k8s_client.views.get_user_logs k8s_client.views.get_user_logs_size k8s_client.views.resource_not_found k8s_client.views.is_json k8s_client.views.get_k8s_config_clusters k8s_client.views.get_k8s_config_cluster k8s_client.views.post_k8s_config_cluster k8s_client.views.put_k8s_config_cluster k8s_client.views.delete_k8s_config_cluster k8s_client.views.get_k8s_config_kube_users k8s_client.views.get_k8s_config_kube_user k8s_client.views.post_k8s_config_kube_user k8s_client.views.put_k8s_config_kube_user k8s_client.views.delete_k8s_config_kube_user k8s_client.views.get_k8s_config_contexts k8s_client.views.get_k8s_config_context k8s_client.views.post_k8s_config_context k8s_client.views.put_k8s_config_context k8s_client.views.delete_k8s_config_context k8s_client.views.get_k8s_config_servers k8s_client.views.get_k8s_config_server k8s_client.views.post_k8s_config_server k8s_client.views.put_k8s_config_server k8s_client.views.delete_k8s_config_server k8s_client.views.get_is_alive k8s_client.views.site_map k8s_client.views.resource_not_found k8s_client.views.is_json Attributes ~~~~~~~~~~ .. autoapisummary:: k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log k8s_client.views.file_folder k8s_client.views.resource_managers k8s_client.views.log .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_pods(context_name=None, node_name=None) Get pods list Parameters ---------- ``"context_name"``: `string` (optional) The name of the context of which showing the pods. if ``value`` is `None` the default context name will be used. ``"node_name"``: `string` (optional) The name of the node inside the context of which showing the pods. Returns ------- - JSON containing the full list of pods of the default context if ``context_name`` is `None` and ``node_name`` is `None` - JSON containing the full list of pods of the specified context if ``context_name`` is a `` and ``node_name`` is `None` - JSON containing the full list of pods of the node of the specified context if ``context_name`` is a `` and ``node_name`` is a `` - Error message with return code `500` if ``context_name`` is **NOT** a `` - JSON containing empty pods list if ``node_name`` is **NOT** a `` .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_nodes(context_name=None) Get nodes list Parameters ---------- ``"context_name"``: `string` (optional) The name of the context of which showing the nodes. if ``value`` is `None` the default context name will be used. Returns ------- - ``[code: 200]`` JSON containing the full list of nodes of the default context if ``context_name`` is `None` ` - ``[code: 200]`` JSON containing the full list of nodes of the specified context if ``context_name`` is a `` - ``[code: 500]`` Error message if ``context_name`` is **NOT** a `` .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_contexts() Get contexts list Parameters ---------- NONE Returns ------- - ``[code: 200]`` `list` [`dict`] JSON containing the full contexts .. py:function:: get_context(context_name) Get the context info Parameters ---------- ``"context_name"``: `string` (optional) The name of the context of which having the data. Returns ------- - ``[code: 200]`` `dict` JSON containing the data of the default context if ``context_name`` is a `` ` - ``[code: 404]`` `string` Error message if ``context_name`` is **NOT** a `` .. py:function:: get_context_busy_jobs(context_name) Get the info of the busy jobs of the provided context Parameters ---------- ``"context_name"``: `string` (optional) The name of the context of which having the data. Returns ------- - ``[code: 200]`` `dict` JSON containing the data of the default context if ``context_name`` is a `` ` - ``[code: 404]`` `string` Error message if ``context_name`` is **NOT** a `` .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_roles(name=None) Get roles list Parameters ---------- ``"name"``: `string` (optional) The name of the role to search. Returns ------- - JSON containing the full list of roles if ``name`` is `None` - JSON containing the details of the specified role if ``name`` is a `` - Error message with return code `404` if ``name`` is **NOT** a `` .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_groups(name=None) Get groups list Parameters ---------- ``"name"`` : `string` (optional) The name of the group of which showing the details. Returns ------- - ``[code: 200]`` JSON containing the full list of groups if ``_name`` is `None` - ``[code: 200]`` JSON containing the detail of the specified group if ``name`` is a `` - ``[code: 404]`` Error message if ``name`` is **NOT** a `` Notes ----- To each returned group will be added the context details Examples -------- >>> [ { "contexts": [ { "cluster_id": 1, "cost": 0, "id": 1, "kubeuser_id": 1, "max_cores_for_single_job": 105, "name": "context.dev.k8s.master.dafni.hydra.org.uk", "namespace": "default" } ], "id": 1, "name": "umwrg" } ] .. py:function:: post_group() Create a new group Parameters ---------- **Request Body** : `json` JSON containing data for the group: ``"name"`` : `string` The name of the group to create ``"contexts"`` : `list` [`dict`] List of dictionaries of the contexts to attach to the group, eventually empty It can contain the `name` or the `id` of the contexts. The `name` has higher priority, meaning if it is defined, the `id` is ignored If the context is not found, the group will be inserted anyway without contexts Returns ------- - ``[code: 409]`` Error message if ``name`` is already inside the DB - ``[code: 406]`` Error message if ``INPUT`` is **NOT** a `` - ``[code: 200]`` Empty array if ``INPUT`` is valid Examples -------- >>> Body = { "name": "test5", "contexts": [{"id":1}] } >>> Body = { "name": "test15", "contexts": [{"name":"context-test"}] } .. py:function:: delete_group(id=None) Delete a group Parameters ---------- ``"id"``: `int` The id of the group to delete Returns ------- - Error message with return code `409` if there is an integrity error - Error message with return code `404` if ``id`` is **NOT** a `` - JSON containing the deleted group id with return code `200` if ``INPUT`` is valid .. py:function:: update_group(id=None) updates a group Parameters ---------- ``"id"`` : `int` The id of the group to update **Request Body** : `json` JSON containing data for the group: ``"name"``: `string` The name of the group to update ``"contexts"`` : `list` [`dict`] List of dictionaries of the contexts to attach to the group, eventually empty It can contain the `name` or the `id` of the contexts. The `name` has higher priority, meaning if it is defined, the `id` is ignored If the context is not found, the group will be inserted anyway without contexts Returns ------- - ``[code: 404]`` Error message if ``id`` is not inside the DB - ``[code: 406]`` Error message if ``INPUT`` is **NOT** a `` - ``[code: 409]`` Error message if there is an integrity error - ``[code: 200]`` Empty array if ``INPUT`` is valid Examples -------- >>> Body = { "name": "test5", "contexts": [{"id":1}] } >>> Body = { "name": "test15", "contexts": [{"name":"context-test"}] } .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_users(username=None) Get users list .. py:function:: post_user() Create a new user .. py:function:: delete_user(username=None) Delete an user .. py:function:: update_user(username=None) updates an user .. py:function:: update_user_password(username=None) updates an user .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: login_user() Login an user Parameters ---------- **Request Body** : `json` JSON containing data for the data: ``"username"``: `string`, Name of the owner user to login ``"password"``: `string`, Password of the user Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``password`` is NOT valid for the username - ``[code: 200]`` `dict` if ``INPUT`` is valid, with keys: ``"email"`` User email (`str`) ``"first_name"`` User first name (`str`) ``"groups"`` User groups list (`list` [`dict` [ ``"id"`` (`str`), ``"name"`` (`str`) ] ]) ``"id"`` User id (`int`) ``"last_name"`` User last name (`str`) ``"roles"`` User roles list (`list` [`dict` [ ``"id"`` (`str`), ``"name"`` (`str`) ] ]) ``"tokens"`` User tokens (` dict` [ ``"access"`` (`str`), ``"refresh"`` (`str`) ] ) ``"username"`` User username (`str`) .. py:function:: uninstall_completed_charts_for_user(username=None) **DEPRECATED!** Uninstalls the completed charts Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to upload the file **Body parameters** ------------------- ``"force_restart_errored_pods"``: `boolean` Force the system to restart the pods in error Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 200]`` `OK` if the job is in `reserved` status .. py:function:: get_user_contexts(username=None) Get user contexts list Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to get the contexts Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 200]`` `list` [`dict`], otherwise Each `dict` items contains: ``"cluster_id"``: `int` ID of the kube config cluster ``"cost"``: `int` Contains the cost for CPU for second of the cluster ``"id"``: `int` ID of the kube config context ``"kubeuser_id"``: `int` ID of the kube config user ``"max_cores_for_single_job"``: `int` Max number of cores usable for a job in MPI inside the cluster ``"name"``: `string` Name of the context ``"namespace"``: `string` Name of the namespace to use .. py:function:: get_user_files(username=None, filename=None) Get user files list Parameters ---------- ``"username"``: `string` Name of the owner user for which to get the files list Query line parameters --------------------- - ``"cluster_uri"`` : `string` Name of the cluster where to look for the files. It corresponds to a folder on the main machine where file are synchronized - ``"relative_path"`` : `string`, optional The relative path from the root folder of the cluster to be used - ``"filename"`` : `string` The name of the file to view the details - ``"foldername"`` : `string` The name of the folder to list the details Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``[code: 200]`` `list` [`dict`], otherwise Each `dict` items contains: - ``"name"`` : `string` Name of the item of the dir list - ``"is_dir"`` : `boolean` Indicates if the path refers to a file or to a folder - ``"size"`` : `int` Indicates the size if the item is a file. If the item is a folder it is always 0. - ``"content"`` : `int` Always 0. - ``"creation_time"`` : `datetime` Datetime of file/folder creation - ``"modified_time"`` : `datetime` Datetime of file/folder update .. py:function:: get_user_file_content(username=None, filename=None) Get user file content Parameters ---------- ``"username"``: `string` Name of the owner user for which to get the file content Query line parameters --------------------- - ``"cluster_uri"`` : `string` Name of the cluster from where download the files content It corresponds to a folder on the main machine where file are synchronized - ``"relative_path"`` : `string`, optional The relative path from the root folder of the cluster to be used - ``"filename"`` : `string` The name of the file to download Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - The file has not been found - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``relative_path`` is NOT provided - ``filename`` is NOT provided or contains not allowed chars - ``[code: 200]`` `bytes` otherwise the content of the file .. py:function:: get_user_folder_content(username=None, foldername=None) Get user folder content Parameters ---------- ``"username"``: `string` Name of the owner user Query line parameters --------------------- - ``"cluster_uri"`` : `string` Name of the cluster from where download the folder. It corresponds to a folder on the main machine where file are synchronized - ``"relative_path"`` : `string`, optional The relative path from the root folder of the cluster to be used - ``"foldername"`` : `string` The name of the folder to download Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``relative_path`` is NOT provided - ``foldername`` is NOT provided or contains not allowed chars - ``[code: 200]`` `bytes` otherwise the zipped content of the folder .. py:function:: upload_file_for_user_full(username=None) Upload a file for a user NOT USED .. py:function:: upload_file_part_for_user(username=None) Upload a part of a file for a user Parameters ---------- ``"username"``: `string` Name of the owner user Body payload parameters --------------------- The endpoint is used for 3 cases: **1) speed-test** ``"command"`` : `speed-test` ``"data"`` : `blob` Data to be sent ``"cluster-uri"`` : `string` Name of the cluster on which upload the data **2) Upload part** ``"command"`` : `upload-part` ``"relative-path"`` : `string` The path where to upload the file ``"file-name"`` : `string` Name of the uploading file ``"chunk-number"``: `int` Counter of the chunk to be uploaded ``"chunk-size"`` : `int` Size of the chunk ``"chunk-data"`` : `blob` Data to be sent ``"cluster-uri"`` : `string` Name of the cluster on which upload the data **3) Join parts** ``"command"`` : `join-parts` ``"relative-path"`` : `string` The path where to upload the file ``"file-name"`` : `string` Name of the uploading file ``"chunks-count"``: `int` Total number the uploaded chunks ``"cluster-uri"`` : `string` Name of the cluster on which upload the data Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``relative_path`` is NOT provided - ``[code: 200]`` `list` otherwise The result of the command .. py:function:: delete_file_for_user(username=None, file_full_path=None) Delete a file for an user Parameters ---------- ``"username"``: `string` Name of the owner user Query line parameters --------------------- - ``"cluster_uri"`` : `string` Name of the cluster from where delete the file. It corresponds to a folder on the main machine where file are synchronized - ``"file_full_path"`` : `string` The full relative path of the file to delete Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``file_full_path`` is NOT provided - ``[code: 200]`` `list` otherwise Deleted file .. py:function:: delete_folder_for_user(username=None, file_full_path=None) Delete a folder for an user Parameters ---------- ``"username"``: `string` Name of the owner user Query line parameters --------------------- - ``"cluster_uri"`` : `string` Name of the cluster from where delete. It corresponds to a folder on the main machine where file are synchronized - ``"file_full_path"`` : `string` The full relative path of the folder to delete Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - ``cluster_uri`` is NOT provided - ``file_full_path`` is NOT provided - ``[code: 200]`` `list` otherwise Deleted folder .. py:function:: get_user_image_tags(username=None, image_id=None) Get user image tags list from the Docker registry Parameters ---------- ``"username"``: `string` Name of the owner user for which to get the associated list ``"image_id"``: `int` Id of the image Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``image_id`` is NOT inside the DB - ``[code: 200]`` `dict` [ `string`, `list` ], otherwise The `dict` contains: - ``"name"`` : `string` Full path of the image, composed by `docker hub server`/`group`/`image` - ``"tags"`` : `list` [ `string` ] Each item contains a semver string representing an image version .. py:function:: get_user_images(username=None, id=None) Get user images list from the DB Parameters ---------- ``"username"``: `string` Name of the owner user for which to get the associated images list Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 200]`` otherwise format: - `list` [`dict`] if `id` is None - `dict` if `id` is not None Each `dict` items contains: - ``"full_path"`` : `string` Full path of the image, composed by `docker hub server`/`group`/`image` - ``"id"`` : `int` Id of the record - ``"tags_list"`` : `list` [ `semver` ] - ``"wide_tags_list"`` : `list` [ `dict` [ `id`: `int`, `image_id`: `int`, `tag`: `semver` ] ] .. py:function:: post_user_image(username=None) Create a new user image Parameters ---------- ``"username"``: `string` Name of the owner user of the inserted image **Request Body** : `json` JSON containing data for the data: ``"full_path"``: `string` Full path of the image containing the docker registry, the group and the name itself ``"tag"``: `semver` String representing the version of the image Returns ------- - ``[code: 401]`` Error message if: The Bearer token is not correctly provided or it is expired - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 409]`` Error message if: - The couple (full_path, tag) are already inside the DB - ``[code: 200]`` otherwise A `dict` contains: - ``"full_path"`` : `string` Full path of the image, composed by `docker hub server`/`group`/`image` - ``"id"`` : `int` Id of the record - ``"tag"`` : `semver` Tag of the image .. py:function:: put_user_image(username=None, image_id=None) Updates an existing user image Parameters ---------- ``"username"``: `string` Name of the owner user of the image ``"image_id"``: `int`, optional Id of the image. Optional if the id is contained inside the request json body **Request Body** : `json` JSON containing data for the data: ``"image_id"``: `int`, optional Id of the image. If it is None, the provided parameter is used instead ``"full_path"``: `string` Full path of the image containing the docker registry, the group and the name itself Returns ------- - ``[code: 401]`` Error message if: The Bearer token is not correctly provided or it is expired - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``image_id`` is NOT inside the DB - ``[code: 406]`` Error message if: - image_id not provided - ``[code: 200]`` otherwise A `dict` contains: - ``"full_path"`` : `string` Full path of the image, composed by `docker hub server`/`group`/`image` - ``"id"`` : `int` Id of the record .. py:function:: delete_user_image(username=None, image_id=None) Delete Image for user Parameters ---------- ``"username"``: `string` Name of the owner user of the image Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 406]`` Error message if: - image_id not provided - ``[code: 200]`` `dict` [ `image_id`: `int` ] otherwise .. py:function:: upload_file_for_job(username=None, job_uuid=None) Upload a file for a reserved job Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to upload the file ``"job_uuid"``: `string` UUID of the job to upload the file Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``job_uuid`` is NOT inside the DB or is not `reserved` - ``[code: 200]`` `OK` if the job is in `reserved` status .. py:function:: start_job(username=None, job_uuid=None) Start a reserved job Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to start the job ``"job_uuid"``: `string` UUID of the job to start Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``job_uuid`` is NOT inside the DB or is not `reserved` - ``[code: 200]`` `OK` if the job is in `reserved` status .. py:function:: kill_job(username=None, job_uuid=None) Kills a running job Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to kill the job ``"job_uuid"``: `string` UUID of the job to kill Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``job_uuid`` is NOT inside the DB or is not running - ``[code: 200]`` `OK` if the job is in `running` status .. py:function:: cancel_job(username=None, job_uuid=None) Cancel a pending job Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to cancel the job ``"job_uuid"``: `string` UUID of the job to cancel Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``job_uuid`` is NOT inside the DB or is not in a `pending` status - ``[code: 200]`` `list` [`string`] Array containing the cancelled job if the job is in `pending` or `reserved` status - ``[code: 200]`` `list` [] empty list otherwise .. py:function:: delete_job(username=None, job_uuid=None) Deletes a job Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to delete the job ``"job_uuid"``: `string` UUID of the job to delete Returns ------- - ``[code: 404]`` Error message if: - ``username`` is NOT inside the DB - ``job_uuid`` is NOT inside the DB - ``[code: 200]`` `list` [`string`] Array containing the deleted job .. py:function:: get_jobs(username=None, limit=None, offset=0) Get user jobs list Parameters ---------- ``"username"``: `string`, optional Name of the owner user for which to get the jobs count ``"offset"``: `int`, optional Offset of the jobs list items count. Used for pagination ``"limit"``: `int`, optional Limit of the jobs list items count. Used for pagination Query parameters: ----------------- ``"image_id"``: `int`, optional Image Id for which to get the jobs count ``"context_id"``: `int`, optional Context Id for which to get the jobs count ``"status"``: `string`, optional Status for which to get the jobs count ``"image_tag_id"``: `int`, optional Image tag Id for which to get the jobs count ``"node_id"``: `int`, optional Node Id for which to get the jobs count ``"node_name"``: `string`, optional Node Name for which to get the jobs count ``"paradigm"``: `string`, optional Paradigm for which to get the jobs count ``"uuid"``: `string`, optional UUID for which to get the jobs count Returns ------- - ``[code: 406]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 200]`` `int` Count of user jobs otherwise .. py:function:: get_jobs_count(username=None) Get user jobs count Parameters ---------- ``"username"``: `string`, Name of the owner user for which to get the jobs count Returns ------- - ``[code: 406]`` Error message if: - ``username`` is NOT inside the DB - ``[code: 200]`` `int` Count of user jobs otherwise .. py:function:: post_jobs(username=None) Creates a new job Parameters ---------- **Request Body** : `json` JSON containing data for the data: ``"cores_to_use"``: `int` Number of cores to use to run the application ``"context_name"``: `string` Name of the context to use to run the application ``"docker_image_name"``: `string` Name of the image representing the application to run ``"docker_image_tag"`` : `string`, Version of the image representing the application to run. **Semver** ``"username"``: `string`, Name of the owner user to use to run the application ``"paradigm"``: `string`, Paradigm to use. Values allowed: mpi | openmp ``"env_variables"``: `string` String representing the list of variables to pass to the application. The list will be of the form "name1=value1, ..., nameK=valueK" All the variables will be instanced inside the environment where the application runs ``"new_job_status"`` : `string`, optional - String representing the status of the new job. Default is "pending" - Accepted values: `pending`, `reserved` Returns ------- - ``[code: 406]`` Error message if: - ``context_name`` is NOT inside the DB - ``paradigm`` is NOT valid - ``username`` is NOT inside the DB - ``cores_to_use`` is a number that overcomes the available cores for the selected context - ``new_job_status`` is NOT valid - ``[code: 200]`` `dict` [`str`, `str`] if ``INPUT`` is valid Examples -------- >>> Body = { "cores_to_use": 30, "context_name": "context.dev.k8s.master.dafni.hydra.org.uk", "docker_image_name": "umwrg/openmp-test-2022", "docker_image_tag" : "0.0.12", "username": "a86302gb", "paradigm": "openmp", "env_variables": "API_USER=pippo, NP=75" } Returns { "job_uuid": "187fe2b9-5003-406f-8bd5-7a7931752e7d", "log_file_name": "a86302gb.187fe2b9-5003-406f-8bd5-7a7931752e7d.log" } .. py:function:: get_user_logs(username=None, cluster_uri=None, filename=None, lines_count=None) Get user logs list .. py:function:: get_user_logs_size(username=None, cluster_uri=None, filename=None) Get user log file size .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson) .. py:function:: get_k8s_config_clusters() Get clusters list from k8s config .. py:function:: get_k8s_config_cluster(cluster_name) Use the provided cluster .. py:function:: post_k8s_config_cluster() Save k8s config cluster .. py:function:: put_k8s_config_cluster(cluster_name) Update k8s config cluster .. py:function:: delete_k8s_config_cluster(cluster_id) Deletes the provided cluster .. py:function:: get_k8s_config_kube_users() Get kube_users list from k8s config .. py:function:: get_k8s_config_kube_user(kube_user_name) Use the provided kube_user .. py:function:: post_k8s_config_kube_user() Save k8s config kube_user .. py:function:: put_k8s_config_kube_user(kube_user_name) Update k8s config kube_user .. py:function:: delete_k8s_config_kube_user(kube_user_id) Deletes the provided kube_user .. py:function:: get_k8s_config_contexts() Get contexts list from k8s config .. py:function:: get_k8s_config_context(context_name) Use the provided context .. py:function:: post_k8s_config_context() Save k8s config context .. py:function:: put_k8s_config_context(context_name) Update k8s config context .. py:function:: delete_k8s_config_context(context_id) Deletes the provided context .. py:function:: get_k8s_config_servers() Get servers list from k8s config .. py:function:: get_k8s_config_server(server_name) Use the provided server .. py:function:: post_k8s_config_server() Save k8s config server .. py:function:: put_k8s_config_server(server_name) Update k8s config server .. py:function:: delete_k8s_config_server(server_id) Deletes the provided server .. py:function:: get_is_alive() Used to check if the website is alive Parameters ---------- NONE Returns ------- - ``[code: 200]`` {"status": "alive"} .. py:function:: site_map() Returns the site map endpoints list Parameters ---------- NONE Returns ------- - ``[code: 200]`` JSON containing the full list of API REST endpoints .. py:data:: file_folder .. py:data:: resource_managers .. py:data:: log .. py:function:: resource_not_found(e) .. py:function:: is_json(myjson)