Similar to `from_scf_task`, the difference is that this method requires
        an input for SCF calculation. A new ScfTask is created and added to the Work.
        This API should be used if the DDB of the GS task should be merged.
501275
def from_scf_input(cls, scf_input, qpoints, is_ngqpt=False, tolerance=None,
                       with_becs=False, ddk_tolerance=None, manager=None):
        
        if is_ngqpt:
            qpoints = scf_input.abiget_ibz(ngkpt=qpoints, shiftk=[0, 0, 0], kptopt=1).points

        qpoints = np.reshape(qpoints, (-1, 3))

        new = cls(manager=manager)
        # Create ScfTask
        scf_task = new.register_scf_task(scf_input)

        if with_becs:
            new.add_becs_from_scf_task(scf_task, ddk_tolerance, ph_tolerance=tolerance)

        for qpt in qpoints:
            if with_becs and np.sum(qpt ** 2) < 1e-12: continue
            multi = scf_task.input.make_ph_inputs_qpoint(qpt, tolerance=tolerance)
            for ph_inp in multi:
                new.register_phonon_task(ph_inp, deps={scf_task: "WFK"})

        return new
1136738
def register_nscf_task(self, *args, **kwargs):
        """"""
        kwargs["task_class"] = NscfTask
        return self.register_task(*args, **kwargs)
711741
String task1(AwsSigner4Request sr) {
        StringBuilder sb = new StringBuilder(sr.getMethod()).append('\n')
                .append(sr.getUri().getRawPath()).append('\n')
                .append(getCanonicalQuery(sr.getUri())).append('\n')
                .append(sr.getCanonicalHeaders()).append('\n')
                .append(sr.getSignedHeaders()).append('\n');

        hexEncode(sb, sha256(sr.getBytes()));
        return sb.toString();
    }
303436
function _createFileTask(gulp, name, config, depTasks, index, startFun, endFun) {
    gulp.task(name, depTasks, function(){
        var s = config.files[index];
       return runFileTaskStream(gulp, s, config, startFun, endFun);
    });
}
1096321
public static Dcsd cs_scc(Dcs A) {
        int n, i, k, b, nb = 0, top, xi[], pstack[], p[], r[], Ap[], ATp[], rcopy[], Blk[];
        Dcs AT;
        Dcsd D;
        if (!Dcs_util.CS_CSC(A))
            return (null); /* check inputs */
        n = A.n;
        Ap = A.p;
        D = Dcs_util.cs_dalloc(n, 0); /* allocate result */
        AT = Dcs_transpose.cs_transpose(A, false); /* AT = A' */
        xi = new int[2 * n + 1]; /* get workspace */
        if (D == null || AT == null)
            return (null);
        Blk = xi;
        rcopy = xi;
        int rcopy_offset = n;
        pstack = xi;
        int pstack_offset = n;
        p = D.p;
        r = D.r;
        ATp = AT.p;
        top = n;
        for (i = 0; i < n; i++) /* first dfs(A) to find finish times (xi) */
        {
            if (!Dcs_util.CS_MARKED(Ap, i))
                top = Dcs_dfs.cs_dfs(i, A, top, xi, 0, pstack, pstack_offset, null, 0);
        }
        for (i = 0; i < n; i++)
            Dcs_util.CS_MARK(Ap, i); /* restore A; unmark all nodes*/
        top = n;
        nb = n;
        for (k = 0; k < n; k++) /* dfs(A') to find strongly connnected comp */
        {
            i = xi[k]; /* get i in reverse order of finish times */
            if (Dcs_util.CS_MARKED(ATp, i))
                continue; /* skip node i if already ordered */
            r[nb--] = top; /* node i is the start of a component in p */
            top = Dcs_dfs.cs_dfs(i, AT, top, p, 0, pstack, pstack_offset, null, 0);
        }
        r[nb] = 0; /* first block starts at zero; shift r up */
        for (k = nb; k <= n; k++)
            r[k - nb] = r[k];
        D.nb = nb = n - nb; /* nb = # of strongly connected components */
        for (b = 0; b < nb; b++) /* sort each block in natural order */
        {
            for (k = r[b]; k < r[b + 1]; k++)
                Blk[p[k]] = b;
        }
        for (b = 0; b <= nb; b++)
            rcopy[rcopy_offset + b] = r[b];
        for (i = 0; i < n; i++)
            p[rcopy[rcopy_offset + Blk[i]]++] = i;
        return D;
    }
72757
public static Scsd cs_scc(Scs A) {
        int n, i, k, b, nb = 0, top, xi[], pstack[], p[], r[], Ap[], ATp[], rcopy[], Blk[];
        Scs AT;
        Scsd S;
        if (!Scs_util.CS_CSC(A))
            return (null); /* check inputs */
        n = A.n;
        Ap = A.p;
        S = Scs_util.cs_dalloc(n, 0); /* allocate result */
        AT = Scs_transpose.cs_transpose(A, false); /* AT = A' */
        xi = new int[2 * n + 1]; /* get workspace */
        if (S == null || AT == null)
            return (null);
        Blk = xi;
        rcopy = xi;
        int rcopy_offset = n;
        pstack = xi;
        int pstack_offset = n;
        p = S.p;
        r = S.r;
        ATp = AT.p;
        top = n;
        for (i = 0; i < n; i++) /* first dfs(A) to find finish times (xi) */
        {
            if (!Scs_util.CS_MARKES(Ap, i))
                top = Scs_dfs.cs_dfs(i, A, top, xi, 0, pstack, pstack_offset, null, 0);
        }
        for (i = 0; i < n; i++)
            Scs_util.CS_MARK(Ap, i); /* restore A; unmark all nodes*/
        top = n;
        nb = n;
        for (k = 0; k < n; k++) /* dfs(A') to find strongly connnected comp */
        {
            i = xi[k]; /* get i in reverse order of finish times */
            if (Scs_util.CS_MARKES(ATp, i))
                continue; /* skip node i if already ordered */
            r[nb--] = top; /* node i is the start of a component in p */
            top = Scs_dfs.cs_dfs(i, AT, top, p, 0, pstack, pstack_offset, null, 0);
        }
        r[nb] = 0; /* first block starts at zero; shift r up */
        for (k = nb; k <= n; k++)
            r[k - nb] = r[k];
        S.nb = nb = n - nb; /* nb = # of strongly connected components */
        for (b = 0; b < nb; b++) /* sort each block in natural order */
        {
            for (k = r[b]; k < r[b + 1]; k++)
                Blk[p[k]] = b;
        }
        for (b = 0; b <= nb; b++)
            rcopy[rcopy_offset + b] = r[b];
        for (i = 0; i < n; i++)
            p[rcopy[rcopy_offset + Blk[i]]++] = i;
        return S;
    }
842893
public boolean createGdalWarpTask(Integer importJobId, Integer importTaskId,
                                      List<String> optsGdalWarp) throws URISyntaxException, HttpException {
        RESTGdalWarpTransform transformTask = new RESTGdalWarpTransform();
        if (!optsGdalWarp.isEmpty()) {
            transformTask.setOptions(optsGdalWarp);
        }
        return this.createTransformTask(importJobId, importTaskId, transformTask);
    }
838881
def from_node(cls, task):
        """"""
        new = super().from_node(task)

        new.update(
            executable=task.executable,
            #executable_version:
            #task_events=
            pseudos=[p.as_dict() for p in task.input.pseudos],
            #input=task.input
        )

        new.register_gridfs_files(
            run_abi=(task.input_file.path, "t"),
            run_abo=(task.output_file.path, "t"),
        )

        return new
855697
private void transfer(Entry[] src, Entry[] dest)
    {
        for (int j = 0; j < src.length; ++j)
        {
            Entry e = src[j];
            src[j] = null;
            while (e != null)
            {
                Entry next = e.getState().next;
                Object key = e.get();
                if (key == null)
                {
                    e.setNext(null);  // Help GC
                    size--;
                }
                else
                {
                    int i = indexFor(e.getHash(), dest.length);
                    e.setNext(dest[i]);
                    dest[i] = e;
                }
                e = next;
            }
        }
    }
564771
def create_for(self, ref_type, ref_id, attributes, silent=False, hook=True):
        
        # if not isinstance(attributes, dict):
        #    raise TypeError('Must be of type dict')
        attributes = json.dumps(attributes)
        return self.transport.POST(body=attributes,
                                   type='application/json',
                                   url='/task/%s/%s/%s' % (ref_type, ref_id,
                                                           self.get_options(silent=silent,
                                                                            hook=hook)))
197885
def is_build_needed(self, data_sink, data_src):
        
        return (self._gettask(data_src).last_build_time == 0 or
                self._gettask(data_src).last_build_time <
                self._gettask(data_sink).last_build_time)
231017
private void putObject(String bucketName, String objectName, Long size, Object data,
      Map<String, String> headerMap, ServerSideEncryption sse)
    throws InvalidBucketNameException, NoSuchAlgorithmException, IOException,
           InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
           InternalException,
           InvalidArgumentException, InsufficientDataException {
    boolean unknownSize = false;

    // Add content type if not already set
    if (headerMap.get("Content-Type") == null) {
      headerMap.put("Content-Type", "application/octet-stream");
    }

    if (size == null) {
      unknownSize = true;
      size = MAX_OBJECT_SIZE;
    }

    if (size <= MIN_MULTIPART_SIZE) {
      // Single put object.
      if (sse != null) {
        sse.marshal(headerMap);
      }
      putObject(bucketName, objectName, size.intValue(), data, null, 0, headerMap);
      return;
    }

    /* Multipart upload */
    int[] rv = calculateMultipartSize(size);
    int partSize = rv[0];
    int partCount = rv[1];
    int lastPartSize = rv[2];
    Part[] totalParts = new Part[partCount];

    // if sse is requested set the necessary headers before we begin the multipart session.
    if (sse != null) {
      sse.marshal(headerMap);
    }

    // initiate new multipart upload.
    String uploadId = initMultipartUpload(bucketName, objectName, headerMap);

    try {
      int expectedReadSize = partSize;
      for (int partNumber = 1; partNumber <= partCount; partNumber++) {
        if (partNumber == partCount) {
          expectedReadSize = lastPartSize;
        }

        // For unknown sized stream, check available size.
        int availableSize = 0;
        if (unknownSize) {
          // Check whether data is available one byte more than expectedReadSize.
          availableSize = getAvailableSize(data, expectedReadSize + 1);
          // If availableSize is less or equal to expectedReadSize, then we reached last part.
          if (availableSize <= expectedReadSize) {
            // If it is first part, do single put object.
            if (partNumber == 1) {
              putObject(bucketName, objectName, availableSize, data, null, 0, headerMap);
              return;
            }
            expectedReadSize = availableSize;
            partCount = partNumber;
          }
        }

        // In multi-part uploads, Set encryption headers in the case of SSE-C.
        Map<String, String> encryptionHeaders = new HashMap<>();
        if (sse != null && sse.getType() == ServerSideEncryption.Type.SSE_C) {
          sse.marshal(encryptionHeaders);
        }

        String etag = putObject(bucketName, objectName, expectedReadSize, data,
                                uploadId, partNumber, encryptionHeaders);
        totalParts[partNumber - 1] = new Part(partNumber, etag);
      }
      // All parts have been uploaded, complete the multipart upload.
      completeMultipart(bucketName, objectName, uploadId, totalParts);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      abortMultipartUpload(bucketName, objectName, uploadId);
      throw e;
    }
  }
98436
def create(cls, options, session, build_root=None, exclude_patterns=None, tags=None):
    
    # Determine the literal target roots.
    spec_roots = cls.parse_specs(
      target_specs=options.target_specs,
      build_root=build_root,
      exclude_patterns=exclude_patterns,
      tags=tags)

    # Determine `Changed` arguments directly from options to support pre-`Subsystem`
    # initialization paths.
    changed_options = options.for_scope('changed')
    changed_request = ChangedRequest.from_options(changed_options)

    # Determine the `--owner-of=` arguments provided from the global options
    owned_files = options.for_global_scope().owner_of

    logger.debug('spec_roots are: %s', spec_roots)
    logger.debug('changed_request is: %s', changed_request)
    logger.debug('owned_files are: %s', owned_files)
    targets_specified = sum(1 for item
                         in (changed_request.is_actionable(), owned_files, spec_roots.dependencies)
                         if item)

    if targets_specified > 1:
      # We've been provided more than one of: a change request, an owner request, or spec roots.
      raise InvalidSpecConstraint(
        'Multiple target selection methods provided. Please use only one of '
        '--changed-*, --owner-of, or target specs'
      )

    if changed_request.is_actionable():
      scm = get_scm()
      if not scm:
        raise InvalidSpecConstraint(
          'The --changed-* options are not available without a recognized SCM (usually git).'
        )
      changed_files = cls.changed_files(
          scm,
          changes_since=changed_request.changes_since,
          diffspec=changed_request.diffspec)
      # We've been provided no spec roots (e.g. `./pants list`) AND a changed request. Compute
      # alternate target roots.
      request = OwnersRequest(sources=tuple(changed_files),
                              include_dependees=str(changed_request.include_dependees))
      changed_addresses, = session.product_request(BuildFileAddresses, [request])
      logger.debug('changed addresses: %s', changed_addresses)
      dependencies = tuple(SingleAddress(a.spec_path, a.target_name) for a in changed_addresses)
      return TargetRoots(Specs(dependencies=dependencies, exclude_patterns=exclude_patterns, tags=tags))

    if owned_files:
      # We've been provided no spec roots (e.g. `./pants list`) AND a owner request. Compute
      # alternate target roots.
      request = OwnersRequest(sources=tuple(owned_files), include_dependees=str('none'))
      owner_addresses, = session.product_request(BuildFileAddresses, [request])
      logger.debug('owner addresses: %s', owner_addresses)
      dependencies = tuple(SingleAddress(a.spec_path, a.target_name) for a in owner_addresses)
      return TargetRoots(Specs(dependencies=dependencies, exclude_patterns=exclude_patterns, tags=tags))

    return TargetRoots(spec_roots)
541074
def PrepareMergeTaskStorage(self, task):
    
    if task.identifier not in self._task_storage_writers:
      raise IOError('Storage writer for task: {0:s} does not exist.'.format(
          task.identifier))
1134138
def src_builder(self):
        
        try:
            scb = self.sbuilder
        except AttributeError:
            scb = self.dir.src_builder()
            self.sbuilder = scb
        return scb
1336502
private <IN> void executeDataSink(GenericDataSinkBase<?> sink, int superStep) throws Exception {
		Operator<?> inputOp = sink.getInput();
		if (inputOp == null) {
			throw new InvalidProgramException("The data sink " + sink.getName() + " has no input.");
		}
		
		@SuppressWarnings("unchecked")
		List<IN> input = (List<IN>) execute(inputOp);
		
		@SuppressWarnings("unchecked")
		GenericDataSinkBase<IN> typedSink = (GenericDataSinkBase<IN>) sink;

		// build the runtime context and compute broadcast variables, if necessary
		TaskInfo taskInfo = new TaskInfo(typedSink.getName(), 1, 0, 1, 0);
		RuntimeUDFContext ctx;

		MetricGroup metrics = new UnregisteredMetricsGroup();
			
		if (RichOutputFormat.class.isAssignableFrom(typedSink.getUserCodeWrapper().getUserCodeClass())) {
			ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
					new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
		} else {
			ctx = null;
		}

		typedSink.executeOnCollections(input, ctx, executionConfig);
	}
696184
def instantiate_tasks(self):
        
        self.tasks_instances = {}
        for task_name, task_class in self.tasks_classes.items():
            try:
                self.tasks_instances[task_name] = task_class()
            except Exception as ex:
                if not self.configuration[Configuration.ALGORITHM][Configuration.IOSF]:
                    raise GOSTaskException("An exception happened during the task instantiation."
                                           "{exception}".format(exception=ex))