[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[HTCondor-users] Env vars to make htcondor.Schedd() Just Work?



Hi all,Â

I'm setting up the htcondor python client in a docker container with the intent of submitting jobs to a remote cluster. I'm trying to figure out what environmental variables I need to set to not need to specify a schedd_ad for Sehedd() (and a host for Collector(), which ideally wouldn't be needed). I've set the CONDOR_HOST env var (see below) which is what I would expect to work but in my hands it doesn't.Â

Below is an example of what I want to do vs what actually works:

* htcondor.Schedd() - doesn't work, this is what I want to work
* htcondor.Collector() -> schedd_ad - doesn't work
* htcondor.Collector(<host>) -> schedd_ad -> Schedd(schedd_ad) - works

What env vars do I need to set so the first line works?

Here's what I'm doing:

```
n [1]: import os

In [2]: os.environ["_CONDOR_CONDOR_HOST"]
Out[2]: 'htcondor-mini:9618'

In [3]: os.environ["CONDOR_HOST"]
Out[3]: 'htcondor-mini:9618'

In [4]: import htcondor
/usr/local/lib/python3.12/site-packages/htcondor/__init__.py:49: UserWarning: Neither the environment variable CONDOR_CONFIG, /etc/condor/, /usr/local/etc/, nor ~condor/ contain a condor_config source. Therefore, we are using a null condor_config.
 _warnings.warn(message)

### Schedd() only

In [5]: schedd = htcondor.Schedd()
---------------------------------------------------------------------------
HTCondorLocateError            Traceback (most recent call last)
Cell In[5], line 1
----> 1 schedd = htcondor.Schedd()

File /usr/local/lib/python3.12/site-packages/htcondor/_lock.py:70, in add_lock.<locals>.wrapper(*args, **kwargs)
  Â67 try:
  Â68   acquired = LOCK.acquire()
---> 70 Â Â rv = func(*args, **kwargs)
  Â72   # if the function returned a context manager,
  Â73   # create a LockedContext to manage the lock
  Â74   is_cm = is_context_manager(rv)

HTCondorLocateError: Unable to locate local daemon

### schedd_ad from Collector()

In [7]: collector = htcondor.Collector()

In [8]: schedd_ad = collector.locate(htcondor.DaemonTypes.Schedd)
---------------------------------------------------------------------------
HTCondorLocateError            Traceback (most recent call last)
Cell In[8], line 1
----> 1 schedd_ad = collector.locate(htcondor.DaemonTypes.Schedd)

File /usr/local/lib/python3.12/site-packages/htcondor/_lock.py:70, in add_lock.<locals>.wrapper(*args, **kwargs)
  Â67 try:
  Â68   acquired = LOCK.acquire()
---> 70 Â Â rv = func(*args, **kwargs)
  Â72   # if the function returned a context manager,
  Â73   # create a LockedContext to manage the lock
  Â74   is_cm = is_context_manager(rv)

HTCondorLocateError: Unable to locate local daemon

### Full setup

In [9]: collector = htcondor.Collector("htcondor-mini:9618")

In [10]: schedd_ad = collector.locate(htcondor.DaemonTypes.Schedd)

In [11]: schedd = htcondor.Schedd(schedd_ad)

In [12]: sub = htcondor.Submit({
  ...:  Â...:   "executable": "/bin/sleep",
  ...:  Â...:   "initialdir": "/tmp",
  ...:  Â...:   "arguments": "30",
  ...:  Â...:   "output": "/tmp/sleep.out",
  ...:  Â...:   "error": "/tmp/sleep.err",
  ...:  Â...:   "log": "/tmp/sleep.log",
  ...:  Â...: })

In [13]: cluster_id = schedd.submit(sub)

In [15]: cluster_id.cluster()
Out[15]: 2
```

Thanks in advance for any advice,

-g