Sync in only the sources.csv file
545137
def sync_sources(self, force=False):
        """"""
        from ambry.orm.file import File

        self.dstate = self.STATES.BUILDING

        synced = 0

        for fc in [File.BSFILE.SOURCES]:
            bsf = self.build_source_files.file(fc)
            if bsf.fs_is_newer or force:
                self.log('Syncing {}'.format(bsf.file_name))
                bsf.fs_to_objects()
                synced += 1

        return synced
1110551
def import_datasources(path, sync, recursive):
    """"""
    sync_array = sync.split(',')
    p = Path(path)
    files = []
    if p.is_file():
        files.append(p)
    elif p.exists() and not recursive:
        files.extend(p.glob('*.yaml'))
        files.extend(p.glob('*.yml'))
    elif p.exists() and recursive:
        files.extend(p.rglob('*.yaml'))
        files.extend(p.rglob('*.yml'))
    for f in files:
        logging.info('Importing datasources from file %s', f)
        try:
            with f.open() as data_stream:
                dict_import_export.import_from_dict(
                    db.session,
                    yaml.safe_load(data_stream),
                    sync=sync_array)
        except Exception as e:
            logging.error('Error when importing datasources from file %s', f)
            logging.error(e)
179223
function contentsSync(file, options) {
  if (!utils.isObject(file)) {
    throw new TypeError('expected file to be an object');
  }

  try {
    // ideally we want to stat the real, initial filepath
    file.stat = fs.lstatSync(file.history[0]);
  } catch (err) {
    try {
      // if that doesn't work, try again
      file.stat = fs.lstatSync(file.path);
    } catch (err) {
      file.stat = new fs.Stats();
    }
  }

  utils.syncContents(file, options);
  return file;
}
1360228
def sync_release_files(self):
        
        release_files = []

        for release in self.releases.values():
            release_files.extend(release)

        downloaded_files = set()
        deferred_exception = None
        for release_file in release_files:
            try:
                downloaded_file = self.download_file(
                    release_file["url"], release_file["digests"]["sha256"]
                )
                if downloaded_file:
                    downloaded_files.add(
                        str(downloaded_file.relative_to(self.mirror.homedir))
                    )
            except Exception as e:
                logger.exception(
                    f"Continuing to next file after error downloading: "
                    f"{release_file['url']}"
                )
                if not deferred_exception:  # keep first exception
                    deferred_exception = e
        if deferred_exception:
            raise deferred_exception  # raise the exception after trying all files

        self.mirror.altered_packages[self.name] = downloaded_files
326619
def synchronize(self, status):
        """"""
        self._version = status.get('server').get('version')
        self._groups = {}
        self._clients = {}
        self._streams = {}
        for stream in status.get('server').get('streams'):
            self._streams[stream.get('id')] = Snapstream(stream)
            _LOGGER.debug('stream found: %s', self._streams[stream.get('id')])
        for group in status.get('server').get('groups'):
            self._groups[group.get('id')] = Snapgroup(self, group)
            _LOGGER.debug('group found: %s', self._groups[group.get('id')])
            for client in group.get('clients'):
                self._clients[client.get('id')] = Snapclient(self, client)
                _LOGGER.debug('client found: %s', self._clients[client.get('id')])
938126
def flush_synced(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.flush_synced(index=self._name, **kwargs)
962254
def fix(csvfile):
    ''''''
    header('Apply fixes from {}', csvfile.name)
    bads = []
    reader = csv.reader(csvfile)
    reader.next()  # Skip header
    for id, _, sources, dests in reader:
        advice = Advice.objects.get(id=id)
        sources = [s.strip() for s in sources.split(',') if s.strip()]
        dests = [d.strip() for d in dests.split(',') if d.strip()]
        if not len(sources) == len(dests):
            bads.append(id)
            continue
        for source, dest in zip(sources, dests):
            echo('{0}: Replace {1} with {2}', white(id), white(source), white(dest))
            advice.subject = advice.subject.replace(source, dest)
            advice.content = advice.content.replace(source, dest)
        advice.save()
        index(advice)
    for id in bads:
        echo('{0}: Replacements length not matching', white(id))
    success('Done')
30686
def _sync(pack):
    """"""
    task_queue = Queue()
    result_queue = Queue()
    task = SignedPackage.loads(pack)
    task_queue.put(task)
    task_queue.put('STOP')
    worker(task_queue, result_queue, Value('f', -1))
    result_queue.put('STOP')
    monitor(result_queue)
    task_queue.close()
    task_queue.join_thread()
    result_queue.close()
    result_queue.join_thread()
    return task['id']
1181804
def sync_connect(self):
        """"""
        loop = asyncio.get_event_loop()
        task = loop.create_task(self.connect())
        loop.run_until_complete(task)
688734
private void sync() {
    List<SwimMember> syncMembers = discoveryService.getNodes().stream()
        .map(node -> new SwimMember(MemberId.from(node.id().id()), node.address()))
        .filter(member -> !member.id().equals(localMember.id()))
        .collect(Collectors.toList());
    for (SwimMember member : syncMembers) {
      sync(member.copy());
    }
  }
49308
def sync(self):
        """"""
        for i in range(4):
            self.elk.send(ps_encode(i))
        self.get_descriptions(TextDescriptions.LIGHT.value)
18416
public void sync() {

        if (isClosed) {
            return;
        }

        synchronized (fileStreamOut) {
            if (needsSync) {
                if (busyWriting) {
                    forceSync = true;

                    return;
                }

                try {
                    fileStreamOut.flush();
                    outDescriptor.sync();

                    syncCount++;
                } catch (IOException e) {
                    Error.printSystemOut("flush() or sync() error: "
                                         + e.toString());
                }

                needsSync = false;
                forceSync = false;
            }
        }
    }
1328238
def sync_in(self, release):
        """"""
        tree = release['canonical_dir']
        if os.path.exists(tree) and release.get('rsync_in_objs'):
            out = release['output_dir']
            if not os.path.isdir(out):
                self.log.info('Creating %s', out)
                os.makedirs(out)
            self.call(release['rsync_in_objs'])
            self.call(release['rsync_in_rest'])
1041774
def sync(self):
        """"""
        if self.writeback and self.cache:
            super(_TimeoutMixin, self).__delitem__(self._INDEX)
            super(_TimeoutMixin, self).sync()
            self.writeback = False
            super(_TimeoutMixin, self).__setitem__(self._INDEX, self._index)
            self.writeback = True
        if hasattr(self.dict, 'sync'):
            self.dict.sync()
273541
def sync_balancer_files(self):
        

        def sync():
            for balancer in self.configurables[Balancer].values():
                balancer.sync_file(self.configurables[Cluster].values())

        self.work_pool.submit(sync)
552293
function () {
    insertCfg.model.sync({force: true}).then(function () {
      var streamInserterCfg = util.makeStreamerConfig(insertCfg.model)
      var inserter = dbStreamer.getInserter(streamInserterCfg)

      inserter.connect(function (err) {
        if (err) return callback(err)
        csv()
          .fromFile(insertCfg.filename)
          .on('json', line => {
            inserter.push(transformer2(line))
          })
          .on('done', err => {
            if (err) return callback(err)
            inserter.setEndHandler(callback)
            inserter.end()
          })
      })
    })
  }
1266503
def sync_code(self):
        """"""
        from ambry.orm.file import File
        from ambry.bundle.files import BuildSourceFile

        self.dstate = self.STATES.BUILDING

        synced = 0

        for fc in [File.BSFILE.BUILD, File.BSFILE.META, File.BSFILE.LIB, File.BSFILE.TEST, File.BSFILE.DOC]:
            bsf = self.build_source_files.file(fc)
            if bsf.fs_is_newer:
                self.log('Syncing {}'.format(bsf.file_name))
                bsf.sync(BuildSourceFile.SYNC_DIR.FILE_TO_RECORD)
                synced += 1

        # Only the metadata needs to be driven to the objects, since the other files are used as code,
        # directly from the file record.
        self.build_source_files.file(File.BSFILE.META).record_to_objects()

        return synced