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

Re: [HTCondor-users] Thread safety of htcondor python bindings



Thank you John and Sandeep for answering my question.


On Tue, Feb 27, 2018 at 9:13 AM Sandeep Gupta <sandeep@xxxxxxxxxxxxx> wrote:
That makes sense.

Thanks John for answering.


Sandeep.



On Tue, Feb 27, 2018 at 12:04 PM, John M Knoeller <johnkn@xxxxxxxxxxx> wrote:

This is âsafeâ in the sense that you will never get a partial commit. but not safe in the sense that it is likely you will have some submits fail if you have many processes all trying to talk to the schedd at once, and you donât appear to be retrying when a submit fails. (it can fail because the schedd will only process one submit at a time, and will hang up on any submit that it doesnât manage to start processing within about 20 seconds.

Â

I think it would be better to have your map() create a file or files with the submission information, and then had a single thread in a single process actually do the submits to HTCondor.

Â

-tj

Â

From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx] On Behalf Of Sandeep Gupta
Sent: Tuesday, February 27, 2018 9:22 AM


To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] Thread safety of htcondor python bindings

Â

Hi John,

Â

Thanks for the reply. Consider this small example:

Â

```

def run(njobs):

  schedd = htcondor.Submit()

  sub = htcondor.Submit(...) # details ommitted

  with schedd.transaction() as txn:

    sub.queue(txn, njobs)

Â

Â

p = Pool()

p.map(run, [njobs] * 2]

p.close()

```

Â

These are different processes (not threads). Considering that bindings eventually call `condor_submit`, I am under the assumption that this is a safe thing to do. Could you please confirm that?

Â

If it is not safe, than I will use a synchronization mechanism to serialize the calls. (Unfortunately, I can't fundamentally change our code such that all the submissions are from one process)

Â

Â

Thanks!

Sandeep

Â

Â

Â

On Tue, Feb 27, 2018 at 9:47 AM, John M Knoeller <johnkn@xxxxxxxxxxx> wrote:

The bindings themselves are thread safe as far as we know, but the HTCondor daemons are not multithreaded.ÂÂ In particular, you *cannot*Â have multiple python threads sending commands to the same HTCondor daemon simultaneously.Â

Â

You should design your python programs so that only one thread does job submission for any given schedd, or you are very likely to have intermittent failures of submission and disconnection by the schedd.

Â

You can *probably* get away with multiple threads doing queries to the collector or schedd at the same time, but even then I would encourage you to try and avoid this.

Â

-tj

Â

From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx] On Behalf Of Sandeep Gupta
Sent: Tuesday, February 27, 2018 7:50 AM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] Thread safety of htcondor python bindings

Â

Hello Biruk,

Â

I am a new user of the python bindings of ht condor. I primarily use it via multiprocessing module, and have seen no issues so far. Here is the source code for python bindings:Âhttps://github.com/htcondor/htcondor/tree/master/src/python-bindings

There are some synchronization mechanisms, but I am not aware of any thread safety guarantees. (I could be wrong though).

Â

Â

Sandeep.

Â

On Mon, Feb 26, 2018 at 9:15 PM, Biruk Mammo <birukw@xxxxxxxxxx> wrote:

Hello,

Â

Is the Python htcondor module guaranteed to be thread-safe?

Â

Â


_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/

Â


This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.Â


_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/

Â


This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.Â


_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/


This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.Â_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/