Pathos ThreadPool()返回无序序列

时间:2018-02-09 10:06:32

标签: python-2.7 python-multithreading pathos

我预测一些数据到我的机器学习。然后,我使用pathos ThreadPool同时预测多个数据。示例

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div id="images-wrap">
  <div id="main-image" style="background-image: url('http://elephant-family.org/wp-content/uploads/2015/06/shutterstock_77217466.jpg')">
    <img src="https://cml.sad.ukrd.com/tp/3x2/" id="main-image-sizer">
  </div>
  <div id="image-thumbs">
    
    <div class="image-thumb" onmouseover="$('#main-image').css('background-image', $(this).css('background-image'));" style="background-image: url('https://imagesvc.timeincapp.com/v3/mm/image?url=https%3A%2F%2Ffortunedotcom.files.wordpress.com%2F2014%2F09%2F174187214.jpg&w=800&q=85')">
      <img src="https://cml.sad.ukrd.com/tp/3x2/">
    </div>
    
    
    <div class="image-thumb" onmouseover="$('#main-image').css('background-image', $(this).css('background-image'));" style="background-image: url('https://imagesvc.timeincapp.com/v3/mm/image?url=https%3A%2F%2Ffortunedotcom.files.wordpress.com%2F2014%2F09%2F174187214.jpg&w=800&q=85')">
      <img src="https://cml.sad.ukrd.com/tp/3x2/">
    </div>
    <div class="image-thumb" onmouseover="$('#main-image').css('background-image', $(this).css('background-image'));" style="background-image: url('http://streamafrica.com/wp-content/uploads/2014/01/african-lion-wallpapers-hd-648x372.jpg')">
      <img src="https://cml.sad.ukrd.com/tp/3x2/">
    </div>
    <div class="image-thumb" onmouseover="$('#main-image').css('background-image', $(this).css('background-image'));" style="background-image: url('https://imagesvc.timeincapp.com/v3/mm/image?url=https%3A%2F%2Ffortunedotcom.files.wordpress.com%2F2014%2F09%2F174187214.jpg&w=800&q=85')">
      <img src="https://cml.sad.ukrd.com/tp/3x2/">
    </div>
    <div class="image-thumb" onmouseover="$('#main-image').css('background-image', $(this).css('background-image'));" style="background-image: url('http://streamafrica.com/wp-content/uploads/2014/01/african-lion-wallpapers-hd-648x372.jpg')">
      <img src="https://cml.sad.ukrd.com/tp/3x2/">
    </div>
    <script>
      // hides overflow scroll if less than 5 thumbs
      var thumbs = document.getElementsByClassName('image-thumb');
      var thumbsWrap = document.getElementById('image-thumbs');
      if (thumbs.length < 5) {
        thumbsWrap.style.overflow = 'hidden';
      }
    </script>
    <script>
      // makes '#image-thumbs' not exceed the height of '#main-image'
      var mainImgHeight = document.getElementById('main-image-sizer').style.height;
      var imageThumbsInitialHeight = document.getElementById('image-thumbs').style.height;
      if (imageThumbsInitialHeight > mainImgHeight) {
        document.getElementById('image-thumbs').style.height = mainImgHeight;
      }
    </script>
  </div>
</div>

当我使用ThreadPool()。map(predict,data)时,它会返回错误的json序列:

data 1 
data 2
data 3
data 4

是一种管理序列的方法吗?

0 个答案:

没有答案