File: htchirp.rst

package info (click to toggle)
condor 23.9.6%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 60,012 kB
  • sloc: cpp: 528,272; perl: 87,066; python: 42,650; ansic: 29,558; sh: 11,271; javascript: 3,479; ada: 2,319; java: 619; makefile: 615; xml: 613; awk: 268; yacc: 78; fortran: 54; csh: 24
file content (120 lines) | stat: -rw-r--r-- 3,254 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
:mod:`htcondor.htchirp` API Reference
=====================================

.. module:: htcondor.htchirp

.. py:currentmodule:: htcondor.htchirp

:mod:`htcondor.htchirp` is a Python Chirp client compatible with the
*condor_starter* Chirp proxy server. It is intended for use inside a running
HTCondor job to access files on the submit machine or to query and modify job
ClassAd attributes. Files can be read, written, or removed. Job attributes can
be read, and most attributes can be updated.

Jobs that use :mod:`htcondor.htchirp` module must have the attribute
``WantIOProxy`` set to ``true`` in the job ClassAd
(``want_io_proxy = true`` in the submit description).
:mod:`htcondor.htchirp` only works for jobs run in the
vanilla, paralllel, and java universes.

:mod:`htcondor.htchirp` provides two objects for interacting with the
*condor_starter* Chirp proxy server, :class:`HTChirp` and
:func:`condor_chirp`.

We recommend using :class:`HTChirp` as a context manager,
which automatically handles openining and closing the connection
to the *condor_starter* Chirp proxy server:

.. code-block:: python

   from htcondor.htchirp import HTChirp

   with HTChirp() as chirp:
       # inside this block, the connection is open
       i = chirp.get_job_attr("IterationNum")
       chirp.set_job_attr("IterationNum") = i + 1

The connection may be manually opened and closed using
:meth:`HTChirp.connect` and :meth:`HTChirp.disconnect`.

:func:`condor_chirp` is a wrapper around :class:`HTChirp` that takes a
string containing a :ref:`man-pages/condor_chirp:*condor_chirp*` command (with
arguments) and returns the value from the relevant :class:`HTChirp` method.

.. autoclass:: HTChirp

   .. automethod:: connect
    :noindex:
   .. automethod:: is_connected
     :noindex:
   .. automethod:: disconnect
     :noindex:
   .. automethod:: fetch
     :noindex:
   .. automethod:: put
     :noindex:
   .. automethod:: remove
     :noindex:
   .. automethod:: get_job_attr
     :noindex:
   .. automethod:: set_job_attr
     :noindex:
   .. automethod:: get_job_attr_delayed
     :noindex:
   .. automethod:: set_job_attr_delayed
     :noindex:
   .. automethod:: ulog
     :noindex:
   .. automethod:: read
     :noindex:
   .. automethod:: write
     :noindex:
   .. automethod:: rename
     :noindex:
   .. automethod:: unlink
     :noindex:
   .. automethod:: rmdir
     :noindex:
   .. automethod:: rmall
     :noindex:
   .. automethod:: mkdir
     :noindex:
   .. automethod:: getfile
     :noindex:
   .. automethod:: putfile
     :noindex:
   .. automethod:: getdir
     :noindex:
   .. automethod:: getlongdir
     :noindex:
   .. automethod:: whoami
     :noindex:
   .. automethod:: whoareyou
     :noindex:
   .. automethod:: link
     :noindex:
   .. automethod:: symlink
     :noindex:
   .. automethod:: readlink
     :noindex:
   .. automethod:: stat
     :noindex:
   .. automethod:: lstat
     :noindex:
   .. automethod:: statfs
     :noindex:
   .. automethod:: access
     :noindex:
   .. automethod:: chmod
     :noindex:
   .. automethod:: chown
     :noindex:
   .. automethod:: lchown
     :noindex:
   .. automethod:: truncate
     :noindex:
   .. automethod:: utime
     :noindex:

.. autofunction:: condor_chirp
   :noindex: