コード例 #1
0
ファイル: test_misc.py プロジェクト: zyxue/rsempipeline
 def test_calc_free_space_to_use(self):
     # The following 3 assertions correspond to 3 cases where max_usage
     # could point to
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 5), 0)
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 20), 10)
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 90), 40)
     # when free < min_free
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 100, 200), 0)
コード例 #2
0
ファイル: test_misc.py プロジェクト: bcgsc/rsempipeline
 def test_calc_free_space_to_use(self):
     # The following 3 assertions correspond to 3 cases where max_usage
     # could point to
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 5), 0)
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 20), 10)
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 50, 90), 40)
     # when free < min_free
     self.assertEqual(misc.calc_free_space_to_use(10, 90, 100, 200), 0)
コード例 #3
0
ファイル: rp_transfer.py プロジェクト: zyxue/rsempipeline
def calc_remote_free_space_to_use(r_host, r_username, r_top_outdir, l_top_outdir,
                                  r_cmd_df, r_max_usage, r_min_free, fastq2rsem_ratio):
    # r_real_current_usage is just for giving an idea of real usage on remote,
    # and it's not used for calculating free space to use
    P = misc.pretty_usage

    r_real = get_real_current_usage(r_host, r_username, r_top_outdir)
    r_real_pretty = P(r_real)
    logger.info('real current usage on {r_host} by {r_top_outdir}: '
                '{r_real_pretty}'.format(**locals()))

    r_estimated_current_usage = estimate_current_remote_usage(
        r_host, r_username, r_top_outdir, l_top_outdir, fastq2rsem_ratio)
    r_estimated_current_usage_pretty = P(r_estimated_current_usage)
    logger.info('free space on {r_host}: {r_estimated_current_usage_pretty}'.format(**locals()))

    r_free_space = get_remote_free_disk_space(r_host, r_username, r_cmd_df)
    r_free_space_pretty = P(r_free_space)
    logger.info('free space on {r_host}: {r_free_space_pretty}'.format(**locals()))

    r_max_usage_pretty = P(r_max_usage)
    logger.info('r_max_usage: {0}'.format(r_max_usage_pretty))

    r_min_free_pretty = P(r_min_free)
    logger.info('r_min_free: {0}'.format(r_min_free_pretty))

    r_free_to_use = misc.calc_free_space_to_use(
        r_estimated_current_usage, r_free_space, r_min_free, r_max_usage)
    return r_free_to_use