SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    May 2002
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Multi-threading with Robot

    I have 5 pcs that are running scripts.

    Current Situation:
    The data is split into a different file for each machine. Test Manager then kicks off each of those files thru robot on a separate PC.

    Problem with that...
    One or more of the pcs may get done early and so they just sit there.

    Does anyone know....
    how to have one file where multiple PCs could read the next line of data that hasn't been ran and process it?

    any help would be greatly appreciated...

  2. #2
    Senior Member
    Join Date
    Aug 2004
    Location
    Rochester, NY
    Posts
    158
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Multi-threading with Robot

    hey_indy2002
    <ul type="square"> have each system open a single file on the network[/list]
    <font class="small">Code:</font><hr /><pre>Open it locked for read/write.
    check for error
    while in error
    retry
    wend
    Read the file.
    Save the next line.
    Rewrites the file with the remaining data
    Close it.
    </pre><hr />

    See help page for Open and Lock as well as the example for Lock.

    Phil.

  3. #3
    Member
    Join Date
    May 2002
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Multi-threading with Robot

    Phil,

    Thanks so much for the response. I reviewed the help page on locking.

    The pseudo code example is good for small files, but the files I have are pretty good size.

    Help mentioned being able to lock a certain line. Have you seen an example on that?

    Again, thanks for the help... it's a start in the right direction.
    Harold

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    Rochester, NY
    Posts
    158
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Multi-threading with Robot

    Harold,
    if you read the Lock page you will find that you can only lock sections if you open the database in binary or random mode.
    I'd suggest that this is not what you probably want to do.
    In binary mode you'd have to do the translation between crlf and lines yourself and reading variable length strings requires the size to be written into the file before it.
    In random mode you would have to write your data file with fixed size blocks.

    Locking lines doesn't address the main issue though. You need to either rewrite the file to remove data that is already been processed or you must have additional shared data to indicate what items have already been processed.

    Sharing data between multiple threads is hard to do correctly so I suggest that you do it as simply as possible. Locking the whole file and rewriting the file as each process removes items is simple. Then you only have one lock that is shared data and access to the file is serialized.

    If the file is very large then I'd suggest you read and store chunks to amortize the cost of accessing the file.

    Alternatively it may make sense to break the file up into smaller pieces instead.

    Phil

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 03:54 PM.

Copyright BetaSoft Inc.